LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   JS, Sajax and UTF8 (http://www.linuxquestions.org/questions/programming-9/js-sajax-and-utf8-695615/)

eantoranz 01-07-2009 01:15 PM

JS, Sajax and UTF8
 
Well.. those three can be a real headache, right?

Well.. let's see what's going on. I'm trying to send this string through sajax to my php script:
Code:

Huáscar
That would be Hu\uc3a1scar (is that right?)

On the wire, FF(Sajax) is sending: Hu%E1scar and what I get in PHP is:
Code:

Hu�scar
The � is \341 (0x48 0x75 0xe1 0x73) on the wire, in other words: Hu\341scar (I died and saw what the wire brings).

What trick do I have to try? For example, I tried using escape on JS and rawurldecode on PHP, but this is the result:
On the wire on the request (sajax):
Code:

Hu%25E1scar
On the response:
Code:

Hu�scar
Hu\341scar. Well... at least the escape/rawurldecode pair is concise. But then what do I have to do so that the 'á' arrives as an 'á' on php?

Thanks in advance!

eantoranz 01-07-2009 01:52 PM

I made a little mistake in the previous post. I said á was \uc3a1, and it's \u00e1. Everything else stands.

eantoranz 01-07-2009 05:03 PM

I removed sajax and used plain old ajax instead and it's working now. Didn't have to use any encoding/decoding procedure to get it working with UTF-8. Thanks anyway, guys!

PS It's too bad I'll have to remove sajax from development, cause I've really liked it so far.

AJenbo 08-30-2009 11:39 AM

Hi, I just wanted to tell you that sajax 0.13 has full UTF-8 support.
You can get it at http://sajax.info/.

Hope to see you there :)


All times are GMT -5. The time now is 01:54 PM.