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,342
  • 23
  • 92
  • 127

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
  • 857,932
  • 118
  • 1,152
  • 1,264
0

This may help you.

javascript - how to convert unicode string to ascii

Community
  • 1
  • 1
RedAnthrax
  • 1,574
  • 1
  • 9
  • 4