[ic] UTF-8 in MySQL

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

On 3/7/06, Mike Heins <mike at perusion.com> wrote:> Quoting Elver Loho (elver.loho at gmail.com):> > 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.>> Documentation doesn't exist because the capability does not exist. It> would be ridiculous to require a pre-query for every query to a database,> which is why this hasn't come up in 8 years of Interchange supporting> SQL databases.
Aye, this is something new. From an idealistic point of view, it makesmore sense than the old system.
> If they really did require a pre-query to return the proper data, it> sounds like MySQL has changed the rules in a big way. I would be extremely> surprised if this was really required.
Allow me to demonstrate. Fresh connection via the command line mysql client:
(rus field is defined with 'text character set utf8' and text wasentered from a custom-made program as an utf8 string after setting'set name utf8'. it refused to work correctly without that command.)
mysql> select rus from locale where id=288;+-----------------------+| rus                   |+-----------------------+| ?? ?? ????????? ????. |+-----------------------+1 row in set (0.00 sec)
mysql> set names utf8;Query OK, 0 rows affected (0.00 sec)
mysql> select rus from locale where id=288;+----------------------------------------+| rus                                    |+----------------------------------------+| ит ис сометхинг елсе. |+----------------------------------------+1 row in set (0.00 sec)
> There must be a way to prevent it from munging this data without having> to have a pre-query every time. Have you looked at DBI and MySQL> documentation about this?
I can't say I have, but I think there is a way. It involves querieswith casting/conversion.
Example after 'set names latin1':
mysql> select convert(rus using binary) from locale where id=288;+----------------------------------------+| convert(rus using binary)              |+----------------------------------------+| ит ис сометхинг елсе. |+----------------------------------------+1 row in set (0.00 sec)
Could you possibly point me towards DBI documentation regarding this?


More information about the interchange-users mailing list