public static String encode ( String component ) { if ( component != null ) { try { return URLEncoder . encode ( component , UTF_8 . name ( ) ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( "JVM must support UTF-8" , e ) ; } } return null ; }
Encode a path segment escaping characters not valid for a URL .