Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 asp.net <--> mysql, cannot display chinese why??

views
     
TSerictioh84
post Feb 16 2006, 03:38 PM, updated 19y ago

On my way
****
Senior Member
638 posts

Joined: Dec 2004
From: Sri Kembangan | Penang


i have a table in my database, 1 of the column i have set it to utf8 encoding using the following command :

alter table myTable column myColumn character set=utf8;

now in the webhosting ctrl panel's phpmyadmin, it can display chinese well but when i query out in my webpage it shows ????. why?

i have added CHARSET=utf8 in my connection string already but still the same. any idea?"
silverhawk
post Feb 17 2006, 01:19 PM

I'm Positively Lustrous
Group Icon
Elite
4,738 posts

Joined: Jan 2003


First, check that your page is also using charset=utf-8 so the browser can auto detect the character set.
the html code to add to the header is
CODE

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


TSerictioh84
post Feb 17 2006, 08:39 PM

On my way
****
Senior Member
638 posts

Joined: Dec 2004
From: Sri Kembangan | Penang


already added this line, nothing changed also. anyone can explain to me more what's the different between utf8 and gb2312 and big5?
silverhawk
post Feb 17 2006, 08:48 PM

I'm Positively Lustrous
Group Icon
Elite
4,738 posts

Joined: Jan 2003


The main difference is how they are stored in bytes.
Read this for some direction: http://en.wikipedia.org/wiki/Character_encoding

What browser do you use? Try going to view -> Character Encoding in firefox and select one of the chinese encoding methods and see whether the text got display or not.
Eventless
post Feb 17 2006, 08:58 PM

Look at all my stars!!
*******
Senior Member
2,641 posts

Joined: Jan 2003
UT8 or Unicode is designed to represent all the characters for all the languages in the world. So theoretically means that you can use it to display any language that you can think of using that character encodiing system.

The two main character encoding for chinese characters are gb2312 for simplified chinese(used in Mainland China) and Big 5 for traditional chinese (used in Taiwan).

The chinese input used in Windows 2000 and above uses gb2312 for simplified chinese and Big 5 for traditional chinese so there's no way to enter UTF8 by default. Better stick to gb2312 or Big 5 for a chinese web site at the moment.

How exactly are you entering UTF8 for chinese characters into your database?
silverhawk
post Feb 17 2006, 10:26 PM

I'm Positively Lustrous
Group Icon
Elite
4,738 posts

Joined: Jan 2003


Well, he said phpmyadmin displays it properly so i assume the data is stored correctly and its just being intepreted wrongly
Eventless
post Feb 18 2006, 07:41 AM

Look at all my stars!!
*******
Senior Member
2,641 posts

Joined: Jan 2003
There's two places where this thing could go wrong. During entry and during output. If you enter the text as something other than utf-8 and you specify utf-8 as the charset to use, you won't be able to see the page correctly.
The other scenario would be the text is entered as utf-8 and using the wrong charset in the html file. Since this one would be solved by the solution given in the second post, this is probrably not the case.
Without knowing how the data is entered into the system, it's hard to determine where exactly the system went wrong.
TSerictioh84
post Feb 23 2006, 05:53 PM

On my way
****
Senior Member
638 posts

Joined: Dec 2004
From: Sri Kembangan | Penang


i got my solution. all these are because the ODCB driver. i changed to use mysql.net driver then everything ok....

 

Change to:
| Lo-Fi Version
0.0120sec    0.25    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 07:43 AM