code: public static String encodePath( String path )
      {
          final StringBuilder sb = new StringBuilder( 2 * path.length() );
  
          for ( int i = 0; i < path.length(); i++ ) {
              final char c = path.charAt( i );
              if ( safeCharacters.get( c ) ) {
                  sb.append( c );
              } else {
                  final byte[] bytes = String.valueOf( c ).getBytes( PcsUtils.UTF8 ); // always work
                  for ( byte b : bytes ) {
                      sb.append( '%' ) //
                              .append( hexadecimal[( b >> 4 ) & 0xf] ) //
                              .append( hexadecimal[ b & 0xf] );
                  }
              }
          }
  
          return sb.toString();
      }
docs: Encode a path as required by the URL specification (<a href="http://www.ietf.org/rfc/rfc1738.txt">
  RFC 1738</a>). This differs from <code>java.net.URLEncoder.encode()</code> which encodes according to the
  <code>x-www-form-urlencoded</code> MIME format.
  
  @param path the path to encode
  @return the encoded path