Better code for converting a char to its UTF-8 percent encoding representation?
Documentation here

public static void main(final String[] args) {
        try {
            System.out.println(URLEncoder.encode("a?&gt;éàùA-Z",
                    System.getProperty("sun.jnu.encoding")));
        } catch (final UnsupportedEncodingException e) {
            System.out.println("BIG PB");
            return; 
        }
    }


Output :


  a%3F%3E%E9%E0%F9A-Z


You have the same for URLEDecoder

EDIT

For URI
Found in src  of iMeMex Dataspace ManagementSystem

public static URI encode(String uriStr) throws URISyntaxException {
    if (uriStr != null) {
        // poor man's encoding
        uriStr = uriStr.replaceAll(" ", "%20");
    }
    return new URI(uriStr);
}


JavaDoc here

But URI from Java does not change other %VALUES.