List of usage examples for java.net URLEncoder encode
public static String encode(String s, Charset charset)
From source file:Main.java
public static String transform(String str) { String strUTF8 = null;/*ww w . j av a 2 s . co m*/ try { strUTF8 = URLEncoder.encode(str, "UTF-8"); } catch (Exception e) { e.printStackTrace(); } return strUTF8; }
From source file:Main.java
public static String encode(String val) { try {/* www. j a va2 s . com*/ return URLEncoder.encode(val, "UTF-8").replace("+", "%20"); } catch (UnsupportedEncodingException e) { return val; } }
From source file:Main.java
public static String urlEncode(String text) { try {/*from w w w.j a v a2 s . c o m*/ return URLEncoder.encode(text, "UTF-8"); } catch (Exception e) { return ""; } }
From source file:Main.java
public static String urlEncode(String code) { try {/* w w w . j a va 2s . c o m*/ return URLEncoder.encode(code, "UTF-8").replaceAll(" ", "").trim(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return null; }
From source file:Main.java
public static String URLEncode(String string) { try {// www .j a v a2s . c o m return URLEncoder.encode(string, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new Error(e.getMessage()); } }
From source file:Main.java
public static String urlEncode(String url) { try {//from w ww . j av a 2s . c o m url = URLEncoder.encode(url, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return url; }
From source file:Main.java
public static final String encodeURL(String str) { try {/*from w w w .ja v a 2 s . c om*/ return URLEncoder.encode(str, "utf-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
From source file:Main.java
public static String urlEncoderStr(String string) { try {// w w w. ja va 2 s. co m return URLEncoder.encode(string, "utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return string; }
From source file:Main.java
private static String urlEncode(String value) { try {/*from www . j a va 2 s.c o m*/ return URLEncoder.encode(value, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return null; }
From source file:Main.java
public static String getEncodedBrand() { String brand = ""; try {//ww w . j a va 2 s .c om brand = URLEncoder.encode(Build.BRAND, "UTF-8"); } catch (Exception e) { } return brand; }