-
Special characters
What is it that makes an ajaxrequest to a PHP script, convert all special characters (like æ,ø,å ) to weird letters (like §,|,&,#), and when i "echo" the same sting back to the ajax/javascript that sendt the string to the PHP script, it's back to normal (æ,ø,å). Okey, easy to understand? Well, se:
ajaxpage: PHP page: ajaxpage:
Æ Ø Å ---------> § | # ----> Æ Ø Å
but I want to save the string to a file, and the file just gets these "§ | #"-letters :confused:
-
It's probably because your PHP script uses a different character encoding to your Javascript pages. I remember I had this problem trying to upload some shift_JIS hiragana to a PHP script. I was using Java, though, so I just changed the encoding. I don't know if Javascript provides a means to do this. Of course, you could always play around with the recode_string() function, but I don't know if the encoding of the string sent from Javascript would always be the same. We'd have to ask Mike on that one, methinks.
Another option is to use escape() on the string in the Javascript, then urldecode() on the PHP side.