code: protected String getEncoding(String content) {
  
          String encoding = content;
          int index = encoding.toLowerCase().indexOf("encoding=\"");
          // encoding attribute found, get the value
          if (index != -1) {
              encoding = encoding.substring(index + 10);
              index = encoding.indexOf("\"");
              if (index != -1) {
                  encoding = encoding.substring(0, index);
                  return encoding.toUpperCase();
              }
          }
          // no encoding attribute found
          return "";
      }
docs: Gets the encoding from the &lt;?XML ...&gt; tag if present.<p>
  
  @param content the file content
  @return String the found encoding