为了创建EBU-STL文件,我需要将字符转换为十六进制,然后将其转换为字节。
像这样:
String text = "This is a text";
char [] chars = text.toCharArray();
for (int j = 0; j < chars.length; j++) {
(byte) chars[j]; // here I would like to convert the char to byte
}
这里的问题是我正在寻找一种将字符转换为编码的方法。例如,这个希腊字符“ω”(小欧米茄),当我将它转换为字节时,它给了我 -55,而我想要 249,这是 Windows 1253 的编码。
那么,如何在java中获得特定编码的字符的十六进制?
长风秋雁
相关分类