Arabic Characters in JSON Decoding

Arabic Characters in JSON decoding

"\u0628\u0633\u0645 \u0627\u0644\u0644\u0647" and "بسم الله" are equivalent in JSON.

PHP just defaults to using Unicode escapes instead of literals for multibyte characters.

You can specify otherwise with JSON_UNESCAPED_UNICODE (providing you are using PHP 5.4 or later).

json_encode('بسم الله', JSON_UNESCAPED_UNICODE);

how I can send Arabic character inside json from android to PHP

You can use URLEncoder in android like below:

json.put("jsonValue",URLEncoder.encode(jsonValue, "utf-8"));

and in your php code use urldecode:

$jsonValue= urldecode($data->jsonValue);

Why the app can't get arabic words from json file with flutter?

///first decode the response to utf-8 string
var myDataString = utf8.decode(responseAsBytes);
///obtain json from string
var myDataJson = jsonDecode(myDataString);

Unity Arabic Text From JSON File

This is likely due to a mismatch in the Encoding. Use the ReadAllText overload which allows you to specify the proper Encoding to use when reading the file.

The default overload will assume UTF-8 unless it can detect UTF-32. Any other encoding will come through incorrectly.

I think the right code is:

var arabic = Encoding.GetEncoding(1256);
File.ReadAllText(filePath,arabic);

How to encode/decode Arabic in JSON String in Javascript?

Using UTF-8 solves the purpose instead of ISO-8859-1.

Arabic Json shows scrambled data

Solved the issue by converting the data from database to UTF8. The data in database was in Latin 1 format. First it is converted to UTF8 using PHP. And this converted data is used for JSON formation. And in receiving side (android app) its decoded using UTF8. And then it worked perfectly for me.
Thanks all..



Related Topics



Leave a reply



Submit