Page 1 of 1

[SOLVED] avascript Ajax showing Unicode

Posted: Fri Feb 26, 2010 12:05 am
by wpsd2006
Hi Im in a little bit pin here

I use charset utf-8 for my web apps set it in the <meta> tag.
I try querying the user info in the database and it return ok -- all the character return correctly, all the username are in chinese

So next move is user filter using ajax -- I use prototypejs
The return result from ajax display different character and unreadable.

I check using Firebug Console -- Header , Post, and Response -- doesn't show any error especially in response text all the chinese character all still intact. But in the browser the chinese character return alot of small box question mark etc.

I already add charset element in the <script> tag of my ajax code.

Any solution for this ? It seems javascript doesn't recognize the chinese character returned from php.

===============================================================================
I'm using MS Access -- cause of hardware restriction
Windows XP with WAMP
PHP 5.3

This problem doesn't appear if I use MySQL which support UTF-8 but because of hardware and system problem I can only use MS Access.
===============================================================================

Re: Javascript Ajax showing Unicode

Posted: Fri Feb 26, 2010 12:13 am
by wpsd2006
One more info I'm developing the code in Ubuntu and Geany then sync it to the XP machine so it should be save as UTF8

Re: Javascript Ajax showing Unicode

Posted: Thu Mar 11, 2010 6:32 am
by wpsd2006
Solved it

Just like other people suggested ( it's all in google :D )

The one that return by printing or echo after ajax call ( here is .php file )
add the header charset on top of it

For chinese and if u use access or mssql like use gb2312