在 android 中显示希伯来语字符
Display Hebrew Characters in android
我正在尝试通过 tcp 从 c# 向 java(android) 发送一个包含希伯来语字符的字符串。
然而,来到java的数据却是问号。
这里是相关代码:
C#(m_client 是 tcpclient class):
NetworkStream stream = client.m_client.GetStream();
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(msg);
stream.Write(bytes, 0, bytes.Length);
Java(Android):
BufferedReader input = new BufferedReader(new InputStreamReader(m_client.getInputStream(),"Windows-1255"));
char[] buffer = new char[1024];
input.read(buffer);
return new String(buffer);
我在java部分尝试了各种编码(windows-1255,UTF-8,ASCII,iso-8859-8-i,iso-8859-8) , 但似乎没有任何效果
我的 OS 是 windows 7
提前谢谢大家。
在设备上转到 settings/language&input 并确保语言是希伯来语或者你怎么说希伯来语在希伯来语中。如果您没有用于测试的希伯来语键盘,这应该设置设备 locale I don't show it listed but then again I don't know Hebrew. Part of the headers in a http request specifically Accept-Language: lain/hebrew and this Hebrew is part of utf-8 but you do have the right to left thing. This trick 可能会有用。祝你好运
这对我有用:
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("Windows-1255")));
我正在尝试通过 tcp 从 c# 向 java(android) 发送一个包含希伯来语字符的字符串。
然而,来到java的数据却是问号。
这里是相关代码:
C#(m_client 是 tcpclient class):
NetworkStream stream = client.m_client.GetStream();
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(msg);
stream.Write(bytes, 0, bytes.Length);
Java(Android):
BufferedReader input = new BufferedReader(new InputStreamReader(m_client.getInputStream(),"Windows-1255"));
char[] buffer = new char[1024];
input.read(buffer);
return new String(buffer);
我在java部分尝试了各种编码(windows-1255,UTF-8,ASCII,iso-8859-8-i,iso-8859-8) , 但似乎没有任何效果
我的 OS 是 windows 7 提前谢谢大家。
在设备上转到 settings/language&input 并确保语言是希伯来语或者你怎么说希伯来语在希伯来语中。如果您没有用于测试的希伯来语键盘,这应该设置设备 locale I don't show it listed but then again I don't know Hebrew. Part of the headers in a http request specifically Accept-Language: lain/hebrew and this Hebrew is part of utf-8 but you do have the right to left thing. This trick 可能会有用。祝你好运
这对我有用:
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("Windows-1255")));