[SOLVED] avascript Ajax showing Unicode

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
wpsd2006
Forum Commoner
Posts: 66
Joined: Wed Jan 07, 2009 12:43 am

[SOLVED] avascript Ajax showing Unicode

Post 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.
===============================================================================
Last edited by wpsd2006 on Thu Mar 11, 2010 6:33 am, edited 2 times in total.
wpsd2006
Forum Commoner
Posts: 66
Joined: Wed Jan 07, 2009 12:43 am

Re: Javascript Ajax showing Unicode

Post 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
wpsd2006
Forum Commoner
Posts: 66
Joined: Wed Jan 07, 2009 12:43 am

Re: Javascript Ajax showing Unicode

Post 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
Post Reply