code: public String encode(BitSet safe, String pString, String cs)
      throws UnsupportedEncodingException {
          if (pString == null) {
              return null;
          }
          return new String(encodeUrl(safe,pString.getBytes(cs)), Charsets.US_ASCII);
      }
docs: Encodes a string into its URL safe form using the specified
  string charset. Unsafe characters are escaped.
  
  This method is analogous to superclass encode() methods,
  additionally offering the ability to specify a different
  'safe' character set (such as EXPANDED_URI_SAFE).
  
  @param safe BitSet of characters that don't need to be encoded
  @param pString String to encode
  @param cs Name of character set to use
  @return Encoded version of <code>pString</code>.
  @throws UnsupportedEncodingException