[ic] UTF-8 in MySQL

Stefan Hornburg racke at linuxia.de
Tue Mar 7 12:05:49 EST 2006

Mike Heins wrote:
> Quoting Elver Loho (elver.loho at gmail.com):
>>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?
> (I dont' know what is going on with your editor, but I can't really decipher
> the above.)
> Just because a particular incantation works in the command line for a
> MySQL shell is not a reason to suggest that is proper for library calls
> to the database.
> If you look at:
>  	http://lists.mysql.com/perl/3563
> You will see that there is a new "mysql_enable_utf8" parameter which you
> could enable for the DSN for locale storage.

But it looks you need to patch DBD::mysql for this parameter :-(


More information about the interchange-users mailing list