Results 1 to 4 of 4
Jun 1, 2011, 11:48 #1
Which UTF8 collation should I use for this?
I'm trying to store strings that may include special characters. Presuming the gurus under the hood here have it working, I'd like to be able to store and retrieve characters similar to the following:
© ɤ ë ¾ ñ
My meta tag:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
I figure it's got to be one of the 3 below -- and I've tried them all on the table, but wondered if maybe that corrupted the data by switching it with data already inside. (No worries, its just filler data for dev purposes.)
utf_bin utf8_general_ci utf8_unicode_ci
Which collation should I use to not have problems with those types of characters?
Thanks for your wisdom!
Jun 1, 2011, 12:05 #2
Hmm... running this query against the database (SHOW VARIABLES LIKE 'character_set%') I find the following:
character_set_client utf8 character_set_connection utf8 character_set_database utf8 character_set_filesystem binary character_set_results utf8 character_set_server latin1 character_set_system utf8 character_sets_dir /data/mysql/prante/share/mysql/charsets/
Jun 1, 2011, 23:32 #3
- Join Date
- May 2007
- Poole, UK
- 93 Post(s)
- 0 Thread(s)
It's best to use mysql_set_charset() rather then mysql_query("SET NAMES 'utf8'") to set the default charset for the connection to the database. It should be used after you established the connection to the database but before you start running any queries against the database
Jun 2, 2011, 09:35 #4
Thank you -- if you don't mind a follow-up: Are there certain benefits to using utf8_general_ci over utf8_unicode_ci (or vice versa) for the database encoding?