Chen Kinnrot
Chen Kinnrot

Reputation: 21015

Passing Hebrew encoded text by AJAX (windows 1255)

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!

Upvotes: 0

Views: 4124

Answers (5)

oren roth
oren roth

Reputation:

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

Upvotes: 1

Chen Kinnrot
Chen Kinnrot

Reputation: 21015

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

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

10x everyone!!!

Upvotes: 2

dusoft
dusoft

Reputation: 11469

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

Upvotes: 1

Assaf Lavie
Assaf Lavie

Reputation: 75983

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.

Upvotes: 4

chaos
chaos

Reputation: 124297

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

Upvotes: 0

Related Questions