Persian/Arabic text displays as ISO encoded text - json

I have a php array of which keys are defined in persian/arabic language such as (دسته بندی ها), when I encode it as JSON using JSONENCODE() it is still displays as persian text but when I decode it using json_decode()
its persian texts displays as ("\u062f\u0633\u062a\u0647 \u0628\u0646\u062f\u06cc \u0645\u062d\u0635\u0648\u0644\u0627\u062a")
I expect to to get texts ("دسته بندی ها") after decoding the json file

Related

what is the encoding mode when html converts base64 to img

I have some trouble in understanding how does html convert base64 to img
From https://www.lucidchart.com/techblog/2017/10/23/base64-encoding-a-visual-explanation/ I learn how string convert to base64,but what dose it happen when base64 encoding to rgb
Base64 is a way to encode binary data as text (so it can be put anywhere you can put text, such as in an HTML attribute value).
The browser converts the Base64 data into whatever form it was in originally.
If that was a PNG it converts it back to a PNG. If it was a JPEG then a JPEG. And so on.
The browser doesn't convert the Base64 data directly to pixel values at all.

How to decode this text and display it as Arabic?

I have some text in a database that is encoded in some way, but I don't know what exactly, and the person who built the database and website left no documentation or comments of any kind. Ask an example, ÌÈÑÇä-1914 is stored in the database, but on the website, it is displayed as جبران-1914. How do I decode ÌÈÑÇä-1914 in order to get the Arabic text?
I've tried decoding ÌÈÑÇä-1914 into windows-1256, ISO-8859-1, UTF-8, but when I put it in an html file and lang-eg in the html tag, and meta charset=utf-8, but nothing is letting me display it as Arabic text instead of some indecipherable characters. How can I convert the encoded text into Arabic?
I realized the problem was that I was exporting the data incorrectly--when I exported it as ISO 8859-2 and converting it to windows 1256 in atom it displayed properly.

How can retrieve / decode html utf-8 character with unicode?

When I try to visit any website which is integrated with unicode हिंदी text then browser display that contain like...
¤ªà¤•à¥�षी à¤•à¥‡ à¤ªà¤¾à¤¸ à¤µà¥‹à¤¸à¤¾à¤°à¥€ à¤¸à¥�ख à¤¸à¥�विधाà¤�à¤� हैं, à¤œà¥‹ à¤‰à¤¨à¤•à¥‡ à¤œà
How to decode this character and convert it into pure unicode?
This is UTF-8 encoded Devanagari wrongly displayed as Windows-1252. If you reverse the direction, e.g.
piconv -f utf-8 -t windows-1252 -s '¤ªà¤•à¥�षी के पास वोसारी सà¥�ख सà¥�विधाà¤�à¤� हैं, जो उनके जà'
then you get parts of the original text back:
��क��?षी के पास वोसारी स��?ख स��?विधा��?��? हैं, जो उनके ज�
Your copy-paste operation made decoding here lossy. Redirect input into a file instead of copy-paste so that you do not introduce any defects.
piconv ships with Perl.

Parsed json data includes question text and image

I have built out a struct and am correctly parsing JSON data and am getting the data to show up with one exception. The text I am getting also includes a URL string. How do I parse both the text and URL image?
Here is the example of the data:
"text": "<p>How would you rate your knowledge about investing in general and more specifically, the relationship between risk and return as shown in this chart?</p>\r\n\r\n<p>\r\n<img src=\"https://services.website.com/Charts/$versions/2180/2180.png\" />\r\n</P>\r\n"
I have a label called question text that the text is being parsed into. Do I need to add a UIImage to below the text label? The problem I am thinking with this is that on some questions I have text then an image, then more text.

{{=XML(some thing)}} can't be parsed in html with web2py

I am using magicsuggest as a auto-complete plugin of a web application with web2py. I define a list variable dt=['张','李'] in the model/db.py. The element in the list is Chinese. However when I embeded the variable in the html like{{=XML(dt)}} according to the manual book of magicsuggest. The chinese character was garbled. After several days searching, I find the list variable with chinese character was encode into hex in the html. I know there is something wrong about encode/decode. Could someone help me to display the correct chinese character in the html?
XML() is meant to take a string, not a list of strings. If you pass it something other than a string, it will first be converted to a string, so your code is equivalent to {{=XML(str(dt))}}, and you'll notice that in Python, str(['张','李']) yields "['\\xe5\\xbc\\xa0', '\\xe6\\x9d\\x8e']".
Instead, you can do {{=XML(dt[0])}}, and you will see the first character in the list displayed properly.
If you want to display a comma separated list surrounded by brackets, you can do:
{{=json.dumps(dt, encoding="UTF-8", ensure_ascii=False)}}