chinese character problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
laura
Forum Newbie
Posts: 19
Joined: Wed May 17, 2006 1:06 pm

chinese character problems

Post by laura »

hi, there, i have problems that i dun understd and dunno where to start to look for it. so i posted here, if anybody knows, pls tell me.
would really appreciate it.here is my question:

my table 'bbs' contains :
bbsid
name
date
msg

name and msg both the collation is : utf8_unicode_ci
and the type for
name : varchar(20)
msg : text

now i can display the chinese character in browser,
i just wan to know, if i type english word in name, then i can only have 20 words there, but when i type chinese it will not have
20 chinese character.
i just want to know why.

and then i have a second question:
when bbs.php in browser i can view the chinese character.
but when i in php myadmin, why i see only strange code? how to solve this problem?
thanks.


thanks in advance who ever ans my question. ^^
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

unicode characters are "multibyte" characters - which means they can be represented by one or more bytes. In the case of Chinese characters they take up 2-3 bytes on average (I think).

In SQL what you're setting is the byte length of the field, not the character length. This is often overlooked since English characters are all exactly one byte long.

As for phpMyAdmin, you'll have to check it's settings.
User avatar
laura
Forum Newbie
Posts: 19
Joined: Wed May 17, 2006 1:06 pm

Post by laura »

thanks for the reply.

ic.i will check it and see. if i still have problems.i will post here. thanks. ^^
Post Reply