在 BlackBerry java 上显示日文字符时出现问题
有谁知道在黑莓屏幕上显示日语/中文字符的最佳方法?我正在从 Google Translate API 检索包含翻译文本的 JSON 响应。我能够使用 UTF-8 正确显示大多数语言,但我相信由于缺少字体/语言包,日文/中文字符将无法显示。
我尝试将应用程序中的字体设置为自定义日语字体 (.ttf),但这不起作用。也许我没有选择正确的字体?我陷入了困境,我不知道下一步该做什么。
我知道这绝对是可能的,因为黑莓手机的一些翻译应用程序将正确显示这些语言。
谢谢!
Does anyone know the best method to display Japanese/Chinese characters on a BlackBerry screen? I'm retrieving a JSON response from the Google Translate API containing the translated text. I am able to display most languages correctly with UTF-8, but I believe the the Japanese / Chinese characters will not display due to a lack of font / language pack.
I've tried to set the font in my application to a custom Japanese font (.ttf), however this did not work. Perhaps I haven't chosen the correct font? I'm at a dead end, I don't know what to try next.
I know that this is definitely possible, as some translation apps for the BlackBerry will display these languages correctly.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否使用此方法的某些变体来设置字体?:
http://supportforums.blackberry.com/t5/Java-Development/Change-fonts-in-a-BlackBerry-application/ta-p/442921
我最接近的其他事情可以找到答案是这样的:
http ://supportforums.blackberry.com/t5/Java-Development/Font-Loader-Manager-Utility/mp/592647#M122351
更新:我查看了您链接中的代码,这应该可以工作 - 假设您已将字体(*.ttf 文件)安装在设备上的正确文件夹中(并且该字体与您尝试显示的特定语言相匹配,因为中文无法通过日语字体)。
我碰巧不知道字体文件应该在黑莓手机上的哪里,但应该很容易用谷歌搜索。
Are you using some variant of this to set the font?:
http://supportforums.blackberry.com/t5/Java-Development/Change-fonts-in-a-BlackBerry-application/ta-p/442921
The closest other thing I could find to an answer is this:
http://supportforums.blackberry.com/t5/Java-Development/Font-Loader-Manager-Utility/m-p/592647#M122351
Update: I looked at the code in your link, and that should work - assuming that you have the font (the *.ttf file) installed in the correct folder on the device (and that the font matches the specific language you're trying to display, since Chinese can't be displayed by a Japanese font).
I don't happen to know where font files are supposed to be on a BlackBerry, but it should be easy to google.
事实证明,我能够添加/显示自定义字体。然而这并没有解决问题。一直以来,我一直在模拟器上进行测试。当我尝试在设备上运行该应用程序时,日语问题就毫无问题地显示了。
感谢您的帮助!
As it turns out, I was able to add/display a custom font. However this did not solve the issue. This whole time, I had been testing on the simulator. Once I tried running the application on the device, the Japanese problems displayed without a problem.
Thanks for your help!