import java.net.URLDecoder; import java.net.URLEncoder; public class T3 { public static void main(String[] args) { String test = "測試"; String encode = URLEncoder.encode(test); String decode = URLDecoder.decode(encode); System.out.println("漢字("+test+")轉碼爲 : "+encode); System.out.println(encode+" 轉換爲漢字爲 : "+decode); } }