标签:
package demo0809.demo1; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Test333 { public static void main(String[] args) throws UnsupportedEncodingException { String str = URLEncoder.encode("中国", "UTF-8"); String[] s = str.substring(1).split("%"); StringBuffer s8 = new StringBuffer(); for(int i=0;i<s.length;i++){ s8.append("\\"+Integer.toOctalString(Integer.valueOf(s[i],16))); } System.out.println(s8.toString()); } }
标签:
原文地址:http://my.oschina.net/zzw922cn/blog/489917