Java examples for Internationalization:Chinese
encoding GB2312
//package com.java2s; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Main { public static String encodingGB2312(String str) { if (str == null || str.length() == 0) { return null; }/* w w w .j a va2s . c o m*/ try { String keywords = URLEncoder.encode(str, "utf-8"); keywords = keywords.replace("+", "%20"); return keywords; } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } }