code: private String ensureMinimalEscaping(String u, final String charset,
              final BitSet bitset) {
          if (u == null) {
              return null;
          }
          for (int i = 0; i < u.length(); i++) {
              char c = u.charAt(i);
              if (!bitset.get(c)) {
                  try {
                      u = LaxURLCodec.DEFAULT.encode(bitset, u, charset);
                  } catch (UnsupportedEncodingException e) {
                      e.printStackTrace();
                  }
                  break;
              }
          }
          return u;
      }
docs: Ensure that there all characters needing escaping
  in the passed-in String are escaped. Stray '%' characters
  are *not* escaped, as per browser behavior.
  
  @param u String to escape
  @param charset
  @param bitset
  @return string with any necessary escaping applied