public static String urlEncode ( final String text ) { try { return URLEncoder . encode ( text , StandardCharsets . UTF_8 . name ( ) ) ; } catch ( final UnsupportedEncodingException e ) { final String message = "Unable to encode text : " + text ; throw new TechnicalException ( message , e ) ; } }
URL encode a text using UTF - 8 .