views:

1200

answers:

6

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!

A: 

What encoding is the web page containing the AJAX call/display?

chaos
+4  A: 

Can'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.

Assaf Lavie
+1  A: 

beware: AJAX works only with UTF8, so be sure to convert characters before sending them, otherwise you can get mangled characters in Javascript.

dusoft
Not true, but not using UTF-8 is asking for problems.
some
+1  A: 

all i needed to do is put this in the respone php file

header('Content-Type: text/html; charset=windows-1255');

10x everyone!!!

Chen Kinnrot
Chen, even though it works now, you'd be doing yourself a Huge favor if you converted to UTF-8 and never look back. It's the standard these days and ANSI codepages are the main reason why so many Hebrew websites suck and look like garbage on different browsers.
Assaf Lavie
+1 on Assaf's suggestion...
Yuval A
i prommise that from now on i'll go on utf 10q
Chen Kinnrot
A: 

thank you :) helped me as well!!!

jjjj
+1  A: 

you should also not use the string from get data, create a new srting...

oren roth