utf8_bin vs. utf8_general_ci
Sep 2009
23
After reading a thread on the phpbuilder forum I now understand the nuances of UTF-8 character coalation on MySQL. NogDog writes:
utf8_bin: compare strings by the binary value of each character in the string
utf8_general_ci: compare strings using general language rules and using case-insensitive comparisonsutf8_general_cs: compare strings using general language rules and using case-sensitive comparisons
So if the WHERE clause of a query says "WHERE first_name = 'Bob'", the different collations would return matches for first_name values of:
'Bob' : utf8_bin, utf8_general_ci and utf8_general_cs
'Böb' : utf8_general_ci and utf8_general_cs
'BÖB' : utf8_general_ci
comments
