LWUIT HTMLComponent 在某些三星型号上显示问号

发布于 2024-12-14 09:09:00 字数 737 浏览 0 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

套路撩心 2024-12-21 09:09:00

这些问题的发生是由于编码错误造成的。我猜当您读取 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.

吹梦到西洲 2024-12-21 09:09:00

这可能是同样的问题:
为什么使用 LWUIT 的三星手机不支持阿拉伯字体?< /a>

LWUIT 不支持阿拉伯位图字体,当字体类型为“系统”时,我们只需
将阿拉伯语支持委托给底层操作系统。如果底层
手机操作系统不包含阿拉伯语支持 LWUIT 不适用于阿拉伯语。

为了解决这个问题,有些人努力实施阿拉伯语
通过修改 LWUIT 来支持位图字体。我们还没有
自以下时间以来合并了任何这些更改:

a.它们非常复杂并且依赖于语言。 b.他们不解决
接受输入的问题。 c.大多数设备都支持阿拉伯语
国家应该支持阿拉伯语,所以这是一个相当小众的问题。

这些解决方案可能足以满足您的需求,但就我个人而言
不会为那一小部分设备付出努力。

It's probably the same problem:
Why arabic font not supported in Samsung mobiles using LWUIT?

LWUIT doesn't support Arabic bitmap fonts, when the font type is 'system' we just
delegate the Arabic support to the underlying OS. If the underlying
phone OS doesn't include Arabic support LWUIT won't work with Arabic.

To workaround this some people have made efforts to implement Arabic
bitmap fonts by modifying LWUIT to support that. We haven't
incorporated any of these changes since:

a. They are very complex and language dependent. b. They don't solve
the issue of accepting input. c. Most devices in Arabic speaking
countries should support Arabic so its a pretty niche problem.

These solutions might be enough for your needs, but personally I
wouldn't make the effort for that small fraction of devices.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文