FileDocCategorySizeDatePackage
EncoderTest.javaAPI DocExample1674Sun Dec 12 10:52:04 GMT 2004None

EncoderTest

public class EncoderTest extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)


    try {
      System.out.println(URLEncoder.encode("This string has spaces",  "UTF-8"));
      System.out.println(URLEncoder.encode("This*string*has*asterisks",  "UTF-8"));
      System.out.println(URLEncoder.encode("This%string%has%percent%signs", 
                                              "UTF-8"));
      System.out.println(URLEncoder.encode("This+string+has+pluses",  "UTF-8"));
      System.out.println(URLEncoder.encode("This/string/has/slashes",  "UTF-8"));
      System.out.println(URLEncoder.encode("This\"string\"has\"quote\"marks", 
                                              "UTF-8"));
      System.out.println(URLEncoder.encode("This:string:has:colons",  "UTF-8"));
      System.out.println(URLEncoder.encode("This~string~has~tildes",  "UTF-8"));
      System.out.println(URLEncoder.encode("This(string)has(parentheses)",
                                              "UTF-8"));
      System.out.println(URLEncoder.encode("This.string.has.periods", 
                                              "UTF-8"));
      System.out.println(URLEncoder.encode("This=string=has=equals=signs", 
                                              "UTF-8"));
      System.out.println(URLEncoder.encode("This&string&has&ersands", "UTF-8"));
      System.out.println(URLEncoder.encode("Thiséstringéhasénon-ASCII characters", 
                                              "UTF-8"));
    }
    catch (UnsupportedEncodingException ex) {
      throw new RuntimeException("Broken VM does not support UTF-8");
    }