您的位置:首页 > 编程语言 > Java开发

一次熬夜解决的java乱码问题

2015-10-11 03:54 585 查看
在java API中String有一个方法

public byte[] getBytes()

Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array.

The behavior of this method when this string cannot be encoded in the default charset is unspecified. The CharsetEncoder class should be used when more control over the encoding process is required.

对这个字符串进行编码为一个字节序列使用平台的默认字符集,结果存储到一个新的字节数组

Returns:
The resultant byte array

整个晚上和客户一直抓包,发现有个字符串的长度不一样,在调用接口的时候,不匹配

解决方案

  慎用该方法
http://www.blogjava.net/baizhihui19870626/articles/388054.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: