Languages
[Edit]
EN

Java example of URLEncoder and URLDecoder (encode, decode, UTF8, UTF-8)

4 points
Created by:
Emelia
237

Example:

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class Example {

    public static void main(String[] args) throws UnsupportedEncodingException {

        String text = "ą ę";

        // spaces are encoded as '+'
        String encodedParam = URLEncoder.encode(text, "UTF-8");
        System.out.println(encodedParam); // %C4%85+%C4%99

        String decode = URLDecoder.decode(encodedParam, "UTF-8");
        System.out.println(decode); // ą ę
    }
}

 

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join