I am using mysql database, innoDB and MyISAM both engines. I want to see the different between utf8 and latin1, so I did a test :
codes On website :
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
attribute of field on database table :
latin1_swedish_ci
Then I typed chinese words "我爱你" and "ĀāĂ㥹ĆćĈ" on the website and click submit button, php and mysql store the words into database. And mysql retrive value from database and display onto the website back.
Output :
website show "我爱你" and "ĀāĂ㥹ĆćĈ".
databse table field show "我爱ä½" and "Ā".
I did test all the following changes :
1) change meta of website to latin-1
and attribute of table field to utf-8
2) change meta of website to utf-8
and attribute of table field to utf-8
too.
3) change meta of website to latin-1
and attribute of table field to latin-1
too.
but the output is still the same, the output change nothing. Why?
Is that I can't test by that method? If so, how do I test the different between utf-8
and latin-1
?
How to make database table field show the words "我爱你" and "ĀāĂ㥹ĆćĈ"?
I am developed a social networking website like Facebook.com which support multiple languages, should I use utf-8
for database field? disadvantage of utf-8
is it takes 3 bytes per character but latin-1
takes 1 byte only. To save the storage, it is better to use latin-1
, but I am not sure what will be the future problem if I use latin-1
instead of utf-8
. Can anyone give me some advice of how to decide which character set to be used?