Simply I have a text box and I want users to be able to use unicode characters.
When submitted, jQuery posts it to the page that handles the request and escape()'s the data.
Code:
$.post('ajax/postlike.php', { statement: escape(pstatement) }, function(data){
All is fine, but if a unicode character is submitted, then we get problems.
For example, if I submit " I’m testing this script. ♥"
It will come out as " I%u2019m testing this script. %u2665"
If I use encodeURIcomponent instead of escape, it comes out a bunch of jumble, such as the yen sign etc.
The code that parses the request goes as following:
PHP Code:
$_POST['statement'] = trim(addslashes(htmlentities(urldecode($_POST['statement']))));
Any suggestions?
|