When making an AJAX call from the client, the server responds with Hebrew text. The PHP page that returns the result is in Windows-1255. For some reason, the result encoding is not Windows-1255, and all I see is gibberish instead of Hebrew. The result purposely contains HTML tags.
I've tried urlencoding, base64 encoding, nothing works.
Thanks!
When making an AJAX call from the client, the server responds with Hebrew text. The PHP page that returns the result is in Windows-1255. For some reason, the result encoding is not Windows-1255, and all I see is gibberish instead of Hebrew. The result purposely contains HTML tags.
I've tried urlencoding, base64 encoding, nothing works.
Thanks!
Share Improve this question asked Feb 17, 2009 at 18:30 Chen KinnrotChen Kinnrot 21k17 gold badges82 silver badges142 bronze badges 1- The default encoding for HTML has been ISO-8859-1 but nowadays UTF-8 is more usual. Windows-1255 is almost the same as ISO-8859-8. You must check if the server responds with the right encoding. I suggest that you change to UTF-8 and you can handle any character. – some Commented Feb 17, 2009 at 18:51
5 Answers
Reset to default 4Can't you change it so that the server return UTF-8 instead of 1255?
There's absolutely no reason these days to continue using ANSI.
all i needed to do is put this in the respone php file
header('Content-Type: text/html; charset=windows-1255');
10x everyone!!!
beware: AJAX works only with UTF8, so be sure to convert characters before sending them, otherwise you can get mangled characters in Javascript.
you should also not use the string from get data, create a new srting...
What encoding is the web page containing the AJAX call/display?