From: Lionel B. <lio...@bo...> - 2008-04-02 18:22:10
|
Philippe Chaintreuil wrote: > So I have two questions: > > 1.) What's wrong? > MySQL ? I'm wondering why it defaults to a charset different than the database one. It seems counterintuitive at best. If you set your database charset to a non-default value it's for a damn good reason... > 2.) How can I fix it? > > Without patching SQLgrey, you might have luck changing the my.cnf file to change the default client charset (assuming you don't have other clients needing to connect with a different charset to the same system). If you want to hack SQLgrey, look for the end of the connectdb method, it already has a special case for MySQL (auto-reconnect as MySQL routinely drops conections by default...). You can then send the SQL query setting the character set you need at this point : $self->{sqlgrey}{dbh}->do("SET CHARACTER SET LATIN1") The MySQL doc isn't clear about what happens when the client auto-reconnects... so your mileage may vary. It would be great if the DBD driver would allow to set the character set at connection-time, but I had no luck browsing it's documentation either. Lionel. |