[ic] UTF-8 in MySQL

Elver Loho elver.loho at gmail.com
Tue Mar 7 10:24:56 EST 2006

On 3/7/06, Stefan Hornburg <racke at linuxia.de> wrote:
> > Um, dude. That's the problem right now with our new table. We're
> > storing UTF-8 text as UTF-8 in the database. Interchange doesn't issue
> > 'set names utf8' or 'set character set utf8' in order to read those
> > fields. How can we tell it to?
> Hm, I assumed that MySQL returns UTF-8 automatically in your case.

It did, sorta. Um. We upgraded to MySQL 4.1. The thing with the 'new'
(5.x is the latest) database system is that it assumes you're
connecting from a 'latin1' terminal.

Now, if your text fields are marked 'latin1' as well, then it just
dumps them on your screen.

And if you put utf8 stuff in latin1 fields, it will still dump them
straight without any problems.

However, if you mark the field as utf8 and you access it with the
default setting ('latin1') then it tries to convert utf8 to latin1,
which doesn't work since we're using cyrillic here.

To get utf8 from MySQL's utf8 fields, *you have to tell MySQL that you
want it to 'convert' things to UTF-8 for you* This can be done using:

1) set names utf8
2) set character set utf8

Interchange will have to send either of those above commands before
executing 'select * from locale' in order to get proper utf8 strings
rather than the question marks it is getting now.

What I need documentation on is how to tell Interchange to send 'set
names utf8' (or the other string) to MySQL before selecting anything
from there. And then it will have to either internally convert some
fields to latin1 OR it can use 'select cast' which can take care of
that as well.

Well, basically, it'd be cool if I could write the query for the
locale database myself. How can I do that with Interchange?

> Which software versions do you use (MySQL, Perl, DBI, DBD::mysql) ?

4.1, 5.8.6, 1.50, 3.0002(?)


More information about the interchange-users mailing list