-   Programming (
-   -   JS, Sajax and UTF8 (

eantoranz 01-07-2009 12: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:

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

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

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):

On the response:

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 12: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 04: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 10:39 AM

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

Hope to see you there :)

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