[moved to dbi-users]

On Wed, Jun 18, 2003 at 02:48:29PM +0200, Brigitte Jellinek wrote:
> On Mon, Jun 16, 2003 at 10:10:52AM -0400, Nathaniel W. Turner wrote:
> > The crux of the problem is that mysql thinks it knows what it's doing, and is 
> > assuming incoming data is latin1*, and thus storing your bytes as though they 
> > were latin1.  

> > *or somesuch 1-byte encoding; 
> that diagnosis is exatly right.  that's why all the
> latin1 characters were ok, and the non latin1 characters
> got mangled

I would guess that mysql is working the basis that the "default
client character set" is latin1.

> all you need to do is to convert every utf8 string you
> feed into mysql into ..... utf8!
> that goes for all literal strings, not only in inserts but also
> in selects:
> 
>   SELECT FROM table WHERE col LIKE CONVERT(_utf8'%blabla%' USING utf8)

So the questions then is "how can you tell mysql that you want to
use utf8 as the client character set?"

> I use this, from perl, through DBI, and I get back classical
> perl strings that contain utf8.

That seems like a bug, in that if the "default client character
set" is latin1 then utf8 should be converted back into latin1 when
returned to that client.

But this character set stuff is very new in mysql v4.1.0.

Have you raised this issue with mysql.com?

Tim.

> so I need another
> 
>   $dbresult = decode("utf8", $dbresult);
> 
> and I'm done!
> 
>      thanks for all the help
> 
>      Brigitte
> 
> p.s. you can find the details at
>   http://perlwelt.horus.at/Beispiele/Magic/PerlUnicodeMysql/
> 
> -- 
> Brigitte        'I never met a chocolate I didnt like'        Jellinek
> [EMAIL PROTECTED]                         http://www.horus.com/~bjelli/
> http://perlwelt.horus.at http://www.perlmonks.org/index.pl?node=bjelli

Reply via email to