我在尝试这个:
byte[] b = String.getBytes("ASCII") and get an UnsupportedEncodingException Exception
String fName = new String(b,"ASCII");
- got the same when used
byte[] b = String.getByte("ISO8859_1");
String fName = new String(b,"ISO8859_1");
Run Code Online (Sandbox Code Playgroud)
编辑:getByte更改为getBytes
该代码不会编译 - 它String.getBytes()不是String.getByte(),它是一个实例方法而不是静态方法.总是值得切割和粘贴一个你已经工作的真实例子(即使它只是一个虚拟应用程序).
但是,假设你有这类似的代码被编译,你应该使用"US-ASCII",并"ISO-8859-1"作为名称,如记录在CharsetJavaDoc中.
| 归档时间: |
|
| 查看次数: |
5818 次 |
| 最近记录: |