code: public static final String encode(String str, String charset)
      {
          if (charset.contains("8859"))
          {
              return encode(str, entityMapISO8859);
          }
          else
          {
              if (charset.toLowerCase().contains("utf"))
              {
                  return encode(str, entityMapUTF8);
              }
              else
              {
                  return encode(str, entityMapPlain);
              }
          }
      }
docs: Encodes String into HTML format. &amp; -&gt; &amp;
  @param str
  @return