Encode and Decode URLs Using UTF-8

Encode and Decode URLs Using UTF-8

This tip shows you how to encode and decode your URLs using the UTF-8 character encoding:

import*;public class URL_Encoder_Decoder{	public static void main(String[] args){      String url = "@sir de caractere@,nr. 1290 'paragraf 3'";      try{         String encode_url=URLEncoder.encode(url,"UTF-8");         String decode_url=URLDecoder.decode(encode_url,"UTF-8");         System.out.println(url);         System.out.println(encode_url);           System.out.println(decode_url);               }catch( e)              {System.out.println("Error:"+e.getMessage());}            	}}Output:@sir de caractere@,nr. 1290 'paragraf 3'%40sir+de+caractere%40%2Cnr.+1290+%27paragraf+3%27@sir de caractere@,nr. 1290 'paragraf 3'
See also  Is Machine Learning Automating Creativity in Graphic Design?

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist