中文转unicode编码:
首先,我给大家提供一个中文转unicode编码的工具
链接:
//download.csdn.net/download/qq_43560721/11988683
操作步骤:
1.用记事本打开.bat文件进行编辑。
2..bat文件一共有3行代码,把后两行删掉,只留一行。
3.把你想要转的中文放入一个资源文件。
4.把此资源文件的路径替换掉.bat文件中原来放的路径且放两遍。
5.找到你的.bat文件,双击运行。
6.重新打开资源文件就可以看到已经转好的unicode编码。
也可用java代码转:
/*
* 中文转unicode编码
*/
public static String toUnicode(String s) {
String as[] = new String[s.length()];
String s1 = "";
for (int i = 0; i < s.length(); i++) {
as[i] = Integer.toHexString(s.charAt(i) & 0xffff);
s1 = s1 + "\\u" + as[i];
}
return s1;
}
unicode编码转中文:
/*
* unicode编码转中文
*/
public static String decodeUnicode( String dataStr) {
try{
StringBuffer buffer = new String