[TYPO3-core] RFC #7942: Enable UTF-8 by default

Michael Stucki michael at typo3.org
Wed Nov 10 13:40:05 CET 2010


Hi Steffen, hello core list :-)

> Just after some short reading:
> 
>> $dbConnectionIsUtf8 =
>> trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['setDBinit'], ' ;') == 'SET
>> NAMES utf8' ? TRUE : FALSE;
> ? TRUE : FALSE is not needed, as == returns boolean.
> I also have "SET CHARACTER SET utf8" from some older advices of "how to
> do utf-8" in mind (e.g. see [1]). This case would not be covered by this
> line, however reading the character_set_* variables would lead to the
> correct decision, wouldn't it?

This query only changes client + results charset, but it does not change
the connection charset. However, it's a requirement that all of these
three (client + connection + results) character sets are UTF-8,
otherwise you may loose content on your way...

Take a look:

mysql> SHOW VARIABLES LIKE '%char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | latin1                     |
| character_set_connection | latin1                     |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | latin1                     |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

mysql> SET CHARACTER SET utf8;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW VARIABLES LIKE '%char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | latin1                     |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

Well however, that's just theory. In practice I agree that some people
might have used the same line like you, which has been wrong all the
time, but the intention was the same. So we should consider it and add a
warning that this setting is wrong.

- michael
-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/


More information about the TYPO3-team-core mailing list