I’m running into a surprising twist in MySql string compare.
Try this:
select “América” = “America”;
±-----------------------+
| “América” = “America” |
±-----------------------+
| 1 |
±-----------------------+
My db and client are in UTF8:
show variables like “%character%”;
±-------------------------±---------------------------+
| Variable_name | Value |
±-------------------------±---------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
±-------------------------±---------------------------+
MySql lets you force an encoding on a per string basis, if you try this:
_utf8"xxx" the string is in UTF8, of
_latin1"xxx" then “xxx” is in Latin 1.
Here is what’s puzzling me:
select _latin1"América" = _latin1"America";
±-------------------------------------+
| _latin1"América" = _latin1"America" |
±-------------------------------------+
| 0 |
±-------------------------------------+
vs
select _utf8"América" = _utf8"America";
±---------------------------------+
| _utf8"América" = _utf8"America" |
±---------------------------------+
| 1 |
±---------------------------------+
Why does it think the UTF8 strings are the same when the Latin1 ones are
not??? What am I not getting?
Thanks!
Wolf