URL 编码，默认编码为 UTF-8。

@param part
待编码字符串
@return 编码字符串
968554
public static String urlEncode(final String part) {
		try {
			return URLEncoder.encode(part, DEFAULT_URL_ENCODING);
		} catch (UnsupportedEncodingException e) {
			throw new ImpossibleException(e);
		}
	}
1205894
public static String percentEncodeUrl(final String urlStr) {
		if (Util.empty(urlStr)) {
			return urlStr;
		}

		try {
			// Avoid double encoding
			String decode = URIUtil.decode(urlStr);
			URI uri = new URI(decode, false);
			return uri.getEscapedURIReference();
		} catch (Exception e) {
			return urlStr;
		}
	}
568749
private static String urlEncodeParameter(String parameter) {
        try {
            return URLEncoder.encode(parameter, "UTF-8");
        } catch (UnsupportedEncodingException ex) {
            log.warn("Could not encode parameter.", ex);
        }
        return parameter;
    }
1031088
public static String encode(String value) {
        if (value == null) {
            return value;
        }
        try {
            value = URLEncoder.encode(value, Constants.UTF_8);
        } catch (UnsupportedEncodingException e) {
            // Do nothing - UTF-8 should always be supported
        }
        return value;
    }
880086
public static String encodeSegment(String segment) {
        requireNonNull(segment, "segment");
        final StringBuilder sb = new StringBuilder(segment.length() + 1);
        sb.append('/');
        for (int i = 0, end = segment.length(); i < end; ++i) {
            char c = segment.charAt(i);
            if (c == '/') {
                sb.append("~1");
                continue;
            }
            if (c == '~') {
                sb.append("~0");
                continue;
            }
            sb.append(c);
        }
        return sb.toString();
    }
88129
public static String urlEncode(String src) throws UnsupportedEncodingException {
		return URLEncoder.encode(src, Charsets.UTF_8.name()).replace("+", "%20");
	}
870114
public static String encodeURIPathComponentXML(String s) {
    StringBuilder result = new StringBuilder();
    for (int i = 0; i < s.length(); i++) {
      if (s.charAt(i) == '&') result.append(Char.encodePercentage(s.charAt(i)));
      else if (s.charAt(i) == '"') result.append(Char.encodePercentage(s.charAt(i)));
      else result.append(Char.encodeURIPathComponent(s.charAt(i)));
    }
    return (result.toString());
  }
36988
public static String urlEncode(String s) {
        try {
            return URLEncoder.encode(s, StandardCharsets.UTF_8.name());
        } catch (UnsupportedEncodingException e) {
            throw new IllegalStateException("get a jdk that actually supports utf-8", e);
        }
    }
777451
def decode(self, charset='utf-8', errors='replace'):
        
        return URL(
            self.scheme.decode('ascii'),
            self.decode_netloc(),
            self.path.decode(charset, errors),
            self.query.decode(charset, errors),
            self.fragment.decode(charset, errors)
        )
330180
public static String encode(String url, Charset charset) {
		if (StrUtil.isEmpty(url)) {
			return url;
		}
		if (null == charset) {
			charset = CharsetUtil.defaultCharset();
		}
		return URLEncoder.DEFAULT.encode(url, charset);
	}
1330872
@Override
    public InputStream getPart(String partName) throws IOException {
        try {
            Part part = request.getPart(partName);
            return (part == null) ? null : part.getInputStream();
        } catch (ServletException e) {
            throw new IOException(e);
        }
    }
3644
private static String encodeUrlPart(final String part) throws UnsupportedEncodingException {
        //we need to go through and check part by part that a section does not need encoding

        int pos = 0;
        for (int i = 0; i < part.length(); ++i) {
            char c = part.charAt(i);
            if(c == '?') {
                break;
            } else if (c == '/') {
                if (pos != i) {
                    String original = part.substring(pos, i);
                    String encoded = URLEncoder.encode(original, UTF_8);
                    if (!encoded.equals(original)) {
                        return realEncode(part, pos);
                    }
                }
                pos = i + 1;
            } else if (c == ' ') {
                return realEncode(part, pos);
            }
        }
        return part;
    }
379626
public static String urlEncode(String text)
    {
        String urlEncodedString=text;
        if(text!=null)
        {
            try
            {
                urlEncodedString=URLEncoder.encode(text,SpiUtil.UTF_8_ENCODING_NAME);
            }
            catch(UnsupportedEncodingException exception)
            {
                throw new FaxException("Error while URL encoding text.",exception);
            }
        }
        
        return urlEncodedString;
    }
1363587
public static String percentEncode(String source) throws AuthException {
    try {
      return URLEncoder.encode(source, "UTF-8")
          .replace("+", "%20")
          .replace("*", "%2A")
          .replace("%7E", "~");
    } catch (UnsupportedEncodingException ex) {
      throw new AuthException("cannot encode value '" + source + "'", ex);
    }
  }
669424
protected Charset getCharSet() {
		String contentType = urlConnection.getContentType();
		Charset charset = Charset.forName("iso-8859-1"); // default charset
		if (contentType != null) {
			// find out about the charset from the URLConnection
			Matcher m = charsetPattern.matcher(contentType);
			if (m.find()) {
				String charsetString = m.group(1);
				try {
					charset = Charset.forName(charsetString);
				} catch (IllegalCharsetNameException e) {
					e.printStackTrace();
				} catch (IllegalArgumentException e) {
					e.printStackTrace();
				}
			}
		}
		return charset;
	}
179015
public static String urlEncode(String input) {
        try {
            return URLEncoder.encode(input, "UTF-8");
        } catch (UnsupportedEncodingException ex) {
            throw new AssertionError("UTF-8 not supported", ex);
        }
    }
239602
public static String urlDecode(String text)
    {
        String urlEncodedString=text;
        if(text!=null)
        {
            try
            {
                urlEncodedString=URLDecoder.decode(text,SpiUtil.UTF_8_ENCODING_NAME);
            }
            catch(UnsupportedEncodingException exception)
            {
                throw new FaxException("Error while URL decoding text.",exception);
            }
        }
        
        return urlEncodedString;
    }