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?

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

This may help you.

javascript - how to convert unicode string to ascii

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.