Android examples for java.net:URL
URL-encodes a given string using ISO-8859-1
import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Main { /**/*from w w w . j a va2 s . c o m*/ * URL-encodes a given string using ISO-8859-1, which may work better with web * pages and umlauts compared to UTF-8. No UnsupportedEncodingException to * handle as it is dealt with in this method. */ public static String encodeUrlIso(String stringToEncode) { try { return URLEncoder.encode(stringToEncode, "ISO-8859-1"); } catch (UnsupportedEncodingException e1) { throw new RuntimeException(e1); } } }