Is there any mapping table between windows code and java charset?

為{幸葍}努か 提交于 2021-02-10 14:53:27

问题


Is there any mapping table between windows code and java charset?

Java Charset list

Windows Code page list

Why I want that: I have to read and analyse a binary file which contains part:

0x00 word codepage like 1252, 936, 65001 I knew, and also 50222 I did not know.
0x02 word string length
0x04 bytes null-terminated string 
...more strings...

I wrote the code:

int codepage = read16(inputStream);
int length = read16(inputStream);
byte[] bytes = new byte[length];
inputStream.read(bytes, 0, length);
String str = new String(bytes, getCharsetFromCodepage(codepage));

and getCharsetFromCodepage is what I want.

来源:https://stackoverflow.com/questions/46047993/is-there-any-mapping-table-between-windows-code-and-java-charset

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!