code: private static String unescape( String str, String encoding )
      {
          //We cannot unescape '+' to space because '+' is allowed in the file name
          //str = str.replace('+', ' ');
          
          //if the str does not contain "%", we don't need to do anything
          if ( str.indexOf( '%' ) < 0 )
          {
              return str;
          }
  
          if ( encoding == null || encoding.length() == 0 )
          {
              encoding = WLS_DEFAULT_ENCODING;
          }
          
          // Do not assume String only contains ascii.  str.length() <= str.getBytes().length
          int out = 0;
  
          byte[] strbytes = str.getBytes();
          int len = strbytes.length;
  
          boolean foundNonAscii = false;
          for ( int in = 0; in < len; in++, out++ )
          {
              if ( strbytes[in] == '%' && ( in + 2 < len ) )
              {
                  if ( Hex.isHexChar( strbytes[in + 1] ) &&
                       Hex.isHexChar( strbytes[in + 2] ) )
                  {
                      strbytes[out] =
                      ( byte ) ( ( Hex.hexValueOf( strbytes[in + 1] ) << 4 ) +
                                 ( Hex.hexValueOf( strbytes[in + 2] ) << 0 ) );
                      in += 2;
                      continue;
                  }
              }
              // IE takes non-ASCII URLs. We use the default encoding
              // if non-ASCII characters are contained in URLs.
              if ( !foundNonAscii &&
                   ( strbytes[in] <= 0x1f || strbytes[in] == 0x7f ) )
              {
                  encoding = System.getProperty( "file.encoding" );
                  foundNonAscii = true;
              }
              strbytes[out] = strbytes[in];
          }
  
          return newString( strbytes, 0, out, encoding );  // was:  BytesToString.newString(...)
      }
docs: URI-unescapes the specified string, except for +/<space>
  encoding.
  
  @param str      String to be unescaped
  @param encoding The name of a character encoding
  @return Unescaped string