byte[] b=...;
String s=new String(b);
或者
String s=new String(b,env);//env:指定的字符编码
String s=new String(b);
或者
String s=new String(b,env);//env:指定的字符编码
解决方案 »
- SWT怎么实现用shift键批量选中指定行?
- 求救SWING自定义按钮
- 求救...JTable 如何多一个格拖拉移动???
- java中swt设计
- [求救] 我机子上的所有.jar都变成 .rar 文件了 ....
- 运行一个java程序时遇到的问题
- AT指令发送短信问题,在线等待!!急急急急
- 在java中关于oracle数据库的连接出错!!(100分相送:8月13日结帖)
- 关于打印某一网页,在线等侍...
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establis
- Yahoo!的聊天室?!
- 如何编译包?老是提醒找不到同一包里的待编译另一个类。
String s = new String(b);
Construct a new String by converting the specified array of bytes using the platform's default character encoding.
String str=b.toString(b);
1.你要知道这个byte数租的编码方式:比如"gb2312","big5","utf8"等。
2.调用String s=new String(b,encoding);
String(byte[] bytes)
Construct a new String by converting the specified array of bytes using the platform's default character encoding.如果你一边的Server是英文Windows,把String用Default Encoding变成byte[]
另一边的Client是中文Windows,用Default Encoding变回String,就会看到乱码