throws UnsupportedEncodingException
throws IOException
  final byte[] encodeText(String text)    throws UnsupportedEncodingException  {    if (compatibilityMode)      {        int len = text.length();        StringBuffer buf = null;        for (int i = 0; i < len; i++)          {            char c = text.charAt(i);            if (c >= 127)              {                if (buf == null)                  {                    buf = new StringBuffer(text.substring(0, i));                  }                buf.append('&');                buf.append('#');                buf.append((int) c);                buf.append(';');              }            else if (buf != null)              {                buf.append(c);              }          }        if (buf != null)          {            text = buf.toString();          }      }    return text.getBytes(encoding);  }