LWUIT HTMLComponent 在某些三星型号上显示问号
我正在使用 LWUIT 创建移动应用程序。 我使用 HTMLComponent 向用户显示帮助文本。请注意,帮助语言是波斯语(使用阿拉伯字母)。
在大多数手机上它工作正常,但在其他手机(例如三星 B3410W)上它只显示问号而不是字母。
我已经设置了 HTMLCallback
但根本没有调用 parsingError
。
设置html代码的指令是这样的:
helpComponent.setHTML("<html dir=\"rtl\"><body><p align=\"justify\">" + body + "</p></body></html>", "UTF8", null, true);
其中body
是调用DataInputStream.readUTF()
方法读取的字符串。
有人知道我错过了什么吗?
PS 应用程序的其他部分(标签、表格等)对于阿拉伯字母没有重大问题。只是 HTMLComponent 有问题。
谢谢,
我将编码“UTF8”更改为“UTF-8”,现在有问题的手机工作正常。似乎(至少某些)三星型号使用“UTF-8”作为该编码的名称。
但我担心其他一些手机可能会出现“UTF-8”问题并接受“UTF8”。
我可以做些什么来让它在所有手机上运行吗?
I'm creating a mobile app using LWUIT.
I used HTMLComponent to show help text to user. Note that the help language is Farsi (which uses Arabic letters).
On most handsets it works fine but on others (e.g. Samsung B3410W) it just shows questions marks instead of letters.
I've set HTMLCallback
but parsingError
is not called at all.
The instruction which sets the html code is this:
helpComponent.setHTML("<html dir=\"rtl\"><body><p align=\"justify\">" + body + "</p></body></html>", "UTF8", null, true);
where body
is a string read by calling DataInputStream.readUTF()
method.
Does any body know what I'm missing?
P.S. other parts of application(Lables, Forms, etc) has no major problems with arabic letters. It's just HTMLComponent which is problematic.
Thank you
I changed "UTF8" for encoding to "UTF-8" and now the problematic handset is working fine. It seems (at least some) samsung models use "UTF-8" as the name of that encoding.
But I'm worried that some other mobile handsets may have problem with "UTF-8" and accept "UTF8".
Is there any thing that I can do to make it working on all phones?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这些问题的发生是由于编码错误造成的。我猜当您读取 readUTF() 时数据已经损坏。做一个简单的实验,创建一个具有您遇到问题的 unicode 值的单个字符体,并打印出该字符的数值,看看它是否与您期望的 unicode 值匹配。
These issues happen because of bad encoding. I'm guessing the data is already corrupted by the time you got to readUTF(). Make a simple experiment of creating a single character body that has a unicode value which you are having a problem with and printout the numeric value of the character to see whether it matches the unicode value you expect.
这可能是同样的问题:
为什么使用 LWUIT 的三星手机不支持阿拉伯字体?< /a>
It's probably the same problem:
Why arabic font not supported in Samsung mobiles using LWUIT?