I have a php page generating json extracting values from a mysql table. Everything is fine except where I have values containing euro symbol (like "€ 20,00") the euro symbol show up in my json as \u20ac...
Like this:
[
{
"id": "535",
"Name": "Pluto",
"fare": "\u20ac 20,00"
}
]
In the page evaluating this json it appears as "€ 20,00", so this is fine, but I really would like it to appear the same also in the json string itself.
Any hint?
Multibyte can - as long as they are not control characters - be displayed literally or escaped as
\uXXXX
and both representations are correct. If you prefer the literally representation and if you use php to create the json then you need to pass the correct options tojson_encode: Parameters
The option you are looking for is JSON_UNESCAPED_UNICODE:
this is a very simple example. I can complete it when i know what do you want exactly.
this example is more perfect: https://jsfiddle.net/a3dmorteza/x7fwto5L/