I know that MySQL has default of latin1 encoding and apparently it takes 1 byte to store a character in latin1 and 3 bytes to store a character in utf-8 - is that correct?
I am working on a site that I hope will be used globally. Do I absolutely need to have utf-8? Or will I be able to get away with using latin1?
Also, I tried to change some tables from latin1 to utf8 but I got this error:
Speficief key was too long; max key length is 1000 bytes
Does anyone know the solution to this? And should I really solve that or may latin1 be enough?
Thanks, Alex
it takes 1 byte to store a character in latin1 and 3 bytes to store a character in utf-8 - is that correct?
It takes 1
bytes to store a latin1
character and 1
to 3
bytes to store a UTF8
character.
If you only use basic latin characters and punctuation in your strings (0
to 128
in Unicode
), both charsets will occupy the same length.
Also, I tried to change some tables from latin1 to utf8 but I got this error: "Speficief key was too long; max key length is 1000 bytes" Does anyone know the solution to this? And should I really solve that or may latin1 be enough?
If you have a column of VARCHAR(334)
or longer, MyISAM
wont't let you create an index on it since there is remote possibility of the column to occupy more that 1000
bytes.
Note that keys of such length are rarely useful. You can create a prefixed index which will be almost as selective for any real-world data.