private static String encodeComponent(String s, Charset charset) {
        // TODO: Optimize me.
        try {
            return URLEncoder.encode(s, charset.name()).replace("+", "%20");
        } catch (UnsupportedEncodingException ignored) {
            throw new UnsupportedCharsetException(charset.name());
        }
    }
private static String encodeComponent(String s, Charset charset) {
       
        try {
            return URLEncoder.encode(s, charset.name()).replace("+", "%20");
        } catch (UnsupportedEncodingException ignored) {
            throw new UnsupportedCharsetException(charset.name());
        }
    }
private static string encodecomponent(string s, charset charset) { try { return urlencoder.encode(s, charset.name()).replace("+", "%20"); } catch (unsupportedencodingexception ignored) { throw new unsupportedcharsetexception(charset.name()); } }