Example usage for java.net URLEncoder encode

List of usage examples for java.net URLEncoder encode

Introduction

In this page you can find the example usage for java.net URLEncoder encode.

Prototype

public static String encode(String s, Charset charset) 

Source Link

Document

Translates a string into application/x-www-form-urlencoded format using a specific java.nio.charset.Charset Charset .

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {

    String line = URLEncoder.encode("name1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8");
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    String line = URLEncoder.encode("na me1", "UTF-8") + "=" + URLEncoder.encode("v&al|ue1", "UTF-8");

    System.out.println(line);//  w  ww .  j a v a  2  s  .  co m
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    System.out.println(URLEncoder.encode("A:B:C:D", "UTF-8"));
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    System.out.println(URLEncoder.encode("A B C", "UTF-8"));
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    System.out.println(URLEncoder.encode("A\"B\"C\"D\"E", "UTF-8"));
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    System.out.println(URLEncoder.encode("A%B%C", "UTF-8"));
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    System.out.println(URLEncoder.encode("A*B*C", "UTF-8"));
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    System.out.println(URLEncoder.encode("A(B)C(D)", "UTF-8"));
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    System.out.println(URLEncoder.encode("A.B.C.E", "UTF-8"));
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    System.out.println(URLEncoder.encode("A~B~C~D", "UTF-8"));
}