Andy Dustman wrote:
On 7/25/05, Dmitry Vasiliev <[EMAIL PROTECTED]> wrote:

Andy Dustman wrote:

On 7/24/05, Jaroslaw Zabiello <[EMAIL PROTECTED]> wrote:

I have mysql 4.1 with database and all tables set to utf8. I have problems
with Zope3.1beta/win32. I cannot query the database with mysqldbda adapter
because I get an error: "unknown encoding: latin1_swedish_ci".

MySQL-4.1, prior to 4.1.9 (and 5.0.3), returns the collation instead
of the character set; that's what you're seeing here. What client
version are you running? I assume you have at least
MySQL-python-1.2.0; older versions probably won't work with MySQL-4.1
(some 1.1 versions will, but 1.0 will not).

I've just added the encoding attribute to the ZopeDatabaseAdapter (rev. 37378).
Also I've changed psycopg adapter to respect the attribute. Can someone change
mysqldbda to use self.getEncoding() instead of connection.character_set_name()?

Note that connection.character_set_name() only retrieves the character
set name that is in use. To actually set the character set name, you
have to do a bit of SQL; for details see:

Also note that this is only applicable to MySQL-4.1 and newer. In 4.0,
the character set is a server configuration option and cannot be
changed by the client.

I've added the encoding attribute to the ZopeDatabaseAdapter (previously there has been hardcoded 'utf-8'). Now when you create the adapter instance you can set the encoding. It's more portable way, since the psycopg for example don't allow to retrieve the database encoding, AFAIK.

I don't use MySQL so I'm afraid to change anything without testing. :-) So the question is: Can someone change to self.getEncoding() and then test the changes?

Dmitry Vasiliev (dima at
Zope3-dev mailing list

Reply via email to