Re: [exim] correct way to set charset in mysql connections?

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Phil Pennock
Fecha:  
A: Arkadiusz Miskiewicz
Cc: exim-users
Asunto: Re: [exim] correct way to set charset in mysql connections?
On 2009-12-21 at 08:20 +0100, Arkadiusz Miskiewicz wrote:
> text = "${lookup mysql{SELECT content FROM user WHERE login='${quote_mysql:
> $local_part}'}}"
>
> that fetches text message from database. Text message contains non ascii
> characters.
>
> Now with mysql >= 4.1 you need to specify charset in which you want to see
> query output (mysql is able to do charset recoding on the fly).
>
> Default is latin1, so if you have some non-latin1 data then output will return
> "?" chars instead of non-latin1 characters.
>
> "SET NAMES utf8" tells mysql to return utf8 output instead of default latin1
> for example.
>
> Now how can I issue charset in such queries?
>
> ${lookup mysql{SET NAMES utf8; SELECT ...
>
> doesn't work.


What happens if you edit /etc/my.cnf to include this?
----------------------------8< cut here >8------------------------------
[client]
default-character-set=utf8
----------------------------8< cut here >8------------------------------

Note that this assumes that all clients on the system should use the
same default.

-Phil