What is the most appropriate Collation for a database in Mysql that will store Portuguese language data?
What is the most appropriate Collation for a database in Mysql that will store Portuguese language data?
Both serve: latin1_swedish_ci
or utf8_general_ci
.
To change the CHARSET
and COLLATION
of an existing bank:
ALTER DATABASE 'sua_base' CHARSET = Latin1 COLLATE = latin1_swedish_ci;
or
ALTER DATABASE 'sua_base' CHARSET = UTF8 COLLATE = utf8_general_ci;
Explanation
CHARSET
and COLLATE
are different things, in MySQL, each CHARSET has COLLATEs, each one with its particularity.
latin1_general_ci
: There is no distinction between uppercase and lowercase letters. Searching for "test", records such as "Test" or "TEST" will be returned. latin1_general_cs
: Distinguishes between uppercase and lowercase letters. Searching for "test" will only return "test". Options such as "Test" and "TEST" will not be returned. latin1_swedish_ci
: It does not distinguish upper and lower case letters or accented characters with cedilla, that is, the record that contains the word "Intuition" will be returned when there is a search for the word "intúicao"