0

I use the following jquery code to load some date on a specific event from external file:

$("#container").load("/include/data.php?name=" + escape(name));

if the javascript "name" variable contains unicode characters it sends some encoded symbols to data.php file, something like this: %u10E1

How can I deal with this encoded symbols? I need to convert them back to readable one.

When I remove the escape function and leave just "name" variable the code doesn't work any more...

Can anyone please help?

King Julien
  • 10,981
  • 24
  • 94
  • 132

2 Answers2

4

If you want to do this manually, then you should be using encodeURIComponent, not escape (which is deprecated)

The jQuery way, however, would be:

$("#container").load("/include/data.php", { "name": name });

Either way PHP should decode it automatically when it populates $_GET.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
0

This may help you.

javascript - how to convert unicode string to ascii

Community
  • 1
  • 1
redanthrax
  • 1,684
  • 1
  • 10
  • 4