Posted 03 September 2006 - 07:34 AM
The strangest thing is that if i type a message (input box, again cp1251 encoding) and then handle it to be saved to a file and display it, everything is okay ...
Do you have any ideas why is this happening?
Posted 05 September 2006 - 07:10 AM
That's one of the drawbacks of Ajax. Whenever you send any data with xmlhttprequest object, it's automatically converted into UTF-8 and when received it's UTF-8 encoded. I had a similar problem. I feel there is no solution to it than again converting it to your desired encoding via PHP. On MSDN I had read that Microsoft is thinking of resolving this issue in future release of IE.
Let's see when it happens
Posted 11 September 2006 - 09:47 PM
Example i send cp1251 encoding to ajax then when it converts it to utf8, i should convert it again to cp1251??? Am i right?
Posted 12 September 2006 - 07:25 AM
But instead of working with encodings try replacing problematic characters with html entities. This had solved my character encoding problem from xmlhttprequest thing. In longer textes it slows but 1 or 2 seconds is acceptable if everything is seen ok.
Posted 13 September 2006 - 04:32 AM
and do whatever you want to do with it. When you need to return info from your php script, use XML if you need to return non-ASCII chars, like this:
header('Content-Type: application/xml'); $out = '<?xml version="1.0" encoding="ORIGINAL_ENCODING?>' . "\r\n"; $out .= '<report xml:lang="LANG_HERE"><message>'.$message.'</message></report>'; echo $out;
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users