02-08-2011 03:13 AM
I am loading JSON using the following sample.
It is working fine. But some fields are in Arabic. Those are showing as junk characters.
الرئيس التنÙيذي ÙÙŠ «الاتصالات» السعودية: Ù…Ùهوم التشبع [0.0]
Is there any solution for this problem? Thanks in advance.
Thanks & Regards
Jomy
Solved! Go to Solution.
02-08-2011 03:26 AM
welcome to the support forums.
how did you encode the arabic characters? to transfer them with json, xml or similar you could use unicode notation, for example. (\uxxxx)
02-08-2011 03:50 AM
I am using the following code to get JSON
Once i Got the JSON i am using the following code to parse it
JSONObject tbl = (JSONObject)JSONData;
JSONArray tblAry = tbl.names();
for(int i = 0; i < tblAry.length(); ++i)
{
try
{
Object rowData = tbl.get(tblAry.getString(i));
JSONObject row = (JSONObject)rowData;
String title = new String(getStringFromObj(row.get("Title")));
String postedDate = getStringFromObj(row.get("PostedDate"));
add(new LabelField(title));
add(new LabelField(postedDate ));
}
catch(JSONException e)
{
System.out.println(e.toString());
continue;
}
}
-----
it is working fine. 'postedDate' is showing well. But 'title' is in Arabic and it is showing as Junk
02-08-2011 03:59 AM
When I Directly access the JSON through browser I am getting the following data. Where Arabic is coming well.
{"0":{"ArticleID":196385,"Title":"الرئيس التنفيذي في «الاتصالات» السعودية: مفهوم التشبع كالجبل الجليدي ونأمل بالدخول للسوق السورية","ArticleText":null,"Summary":" ","Source":"","ArticleSource":"","PostedDate":"2/8
02-08-2011 04:01 AM
maybe you should work on some basics, read
http://en.wikipedia.org/wiki/Character_encoding
to transfer arabic characters (or anything else not ansi) you have to encode them. and decode them later, of course. usually utf8 is used for this.
02-08-2011 04:10 AM
Sorry I am new to Java and Blackberry. The same JSON works with IPHONE.
I will try to encode the JSON input and later decode it.
Thanks
02-09-2011 09:30 AM
In JSON I encode Arabic text in \uxxxx format.And it is working. Thanks
07-17-2012
05:56 AM
- last edited on
07-17-2012
05:59 AM
by
PatL
Hi,
I am Also facing the same problem.
my response of json is in arabic format but when I am going to display it .It is displaying with different format..الرئيس التنÙيذي . Please send me some code so that I can continue with my work..
[Removed personal information to comply with Community Guidelines and Terms and Conditions of Use.]
Thanks in Advance.