[Phpmyadmin-devel] UTF8 and connection encoding
Sebastian Mendel
lists at sebastianmendel.de
Mon Feb 9 12:08:22 CET 2009
On 09.02.2009 10:47, cand. inf. Alexander M. Turek wrote:
> Hi Sebastian and list,
>
> Sebastian Mendel schrieb:
>> if someone changes connection setting in main.php from UTF-8 to
>> something else, all content from DB will be delivered with this encoding
>> to users Browser, but we say the document is UTF-8 and strings coming
>> from us (language files) are in UTF-8
>
> Who changed this anyway? In my original MySQL 4.1 compatibility code,
> the option to change the connection charset was intentionally not given
> to the user - only for dump files, afaik.
>
>> so we end up with a mixed encoding in the HTML output
>
> Right, we would need to either recode the language files or on the fly
> any string that comes from MySQL. But I guess, we would destroy the
> "intention" of that feature - see my explanation below.
>
>> there are two options:
>>
>> - setting PHP output encoding
>>
>> http://php.net/manual/en/mbstring.http.php
>>
>> do not know if this takes care of already mixed encodings
>
> It doesn't, afaik.
>
>> - do not allow switching connection charset
>
> +++ from my side
>
>> why is this required anyway?
>
> Well, if you use some old MySQL application that was coded against MySQL
> 3.23 and thus is not aware of all that charset stuff, it certainly will
> happen that this application writes in a different charset than MySQL
> assumes. For instance, phpBB 2.x internally uses UTF-8 (which MySQL
> prior 4.1 did non support anyway), but does not send "SET NAMES utf8".
> MySQL by default assumes latin1 (which was the default charset in MySQL
> 3.23). The result is that you have kind of double encoded data in your
> tables. If you access these tables with phpMyAdmin, it looks like they
> are displayed wrong (while in fact, phpMyAdmin is right).
>
> Setting the connection charset to latin1 but treating incoming data as
> if it was utf8 is exactly what phpBB 2 and other applications do, so the
> data displays seemingly correctly.
>
> Anyway, when I wrote the code for MySQL 4.1, my opinion was that this
> should not be the problem of phpMyAdmin.
>
> If you decide to keep that "feature", it is imho to prominent where it
> is right now and you should add warnings with tons of exclamation marks
> against using it.
in short: drop this in phpMyAdmin 3?
--
Sebastian Mendel
More information about the Developers
mailing list