Blackberry - Java - Arabic shows corrupted in the JSON output
Arabic shows corrupted in the JSON output
I am开发者_StackOverflow社区 loading JSON using the BlackBerry development guide code sample: Parsing a JSON data structure
It is working fine. But some fields are in Arabic. Those are showing as junk characters.
الرئيس التنÙيذي ÙÙŠ «الاتصالات» السعودية: Ù…Ùهوم التشبع [0.0]
[EDIT]
Following is the JSON data I am getting when I call the JSON through Browser. With the same JSON IPhone Application also working. In blackberry do I have to any specific task to show Arabic ?
Note: I am new to blackberry and Java.
{"0":{"ArticleID":171972,"Title":"الخريجي مدير عام الصوامع لـ «الشرق الأوسط»: المخزون يبلغ 2.5 مليون طن ويكفي استهلاك عام","ArticleText":null,"Summary":" ","Source":"","ArticleSource":"","PostedDate":"8/10/2010","SummaryIsNull":"true","Index":0,"AssociatedImageID":979,"HasAssociatedImage":"true","TitleLength":87,"Priority":0,"ArticleLink":null,"MoreArticlesCount":396,"CommentsCount":0},"1":{"ArticleID":171779,"Title":"العضو المنتدب لقطاع التجزئة في صافولا قشقري لـ «عكاظ»: لا نحتكر تجارة التجزئة ونتفهم احتياجات المستهلك","ArticleText":null,"Summary":" ","Source":"","ArticleSource":"","PostedDate":"8/9/2010","SummaryIsNull":"true","Index":1,"AssociatedImageID":977,"HasAssociatedImage":"true","TitleLength":102,"Priority":0,"ArticleLink":null,"MoreArticlesCount":396,"CommentsCount":0},"2":{"ArticleID":171640,"Title":"كريم محمود نائب رئيس المجموعة المصرفية الاستثمارية لدى البنك لـ \"الخليج\": سيولة \"المشرق\" تؤهله للاستفادة من توقعات النمو ","ArticleText":null,"Summary":" ","Source":"","ArticleSource":"","PostedDate":"8/8/2010","SummaryIsNull":"true","Index":2,"AssociatedImageID":975,"HasAssociatedImage":"true","TitleLength":121,"Priority":0,"ArticleLink":null,"MoreArticlesCount":396,"CommentsCount":0},"3":{"ArticleID":171371,"Title":"المهزع عن مهمة «بنك الدوحة»: نحن نافذة لقطر... ولم نأت للمنافسة ","ArticleText":null,"Summary":" ","Source":"","ArticleSource":"","PostedDate":"8/5/2010","SummaryIsNull":"true","Index":3,"AssociatedImageID":974,"HasAssociatedImage":"true","TitleLength":64,"Priority":0,"ArticleLink":null,"MoreArticlesCount":396,"CommentsCount":0}}
Arabic is one of the most complicated l10n cases.
- It requires unicode (like all non-Latin languages)
- it is right-to-left (like Hebrew and Yiddish)
- Each letter has several variations (separated, start, end, middle)
I think that in your case it is encoding problem on one of the sides: either the sending side (server) corrupts the characters because does not say that they are UTF-8 or your blackberry device does not support Arabic. But if you fix this problem you will probably meet #2 and #3, so be strong! Good luck.
In JSON I encode Arabic text in \uxxxx format.And it is working.
精彩评论