Django

Code

Ticket #4770 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

mysql_old and tables in utf8_unicode_ci -- non-ascii chars problems

Reported by: Guilherme M. Gondim (semente) <semente@taurinus.org> Assigned to: adrian
Milestone: Component: Database wrapper
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

I have a website in Dreamhost and with database engine 'mysql_old'... The non-ascii chars shows deformed, like this: Atenção! Inscrição, Seleção e Música de Câmara. But with 'mysql' in DATABASE_ENGINE the non-ascii chars works fine (I tested with a remotely connection).

[SVN INFO] Revision: 5616 Last Changed Date: 2007-07-05 00:29:18 -0300 (Thu, 05 Jul 2007)

With unicode branch, the problem persists.

PS: I can't install new python-mysqldb in Dreamhost! :-/

Attachments

mysql_old.diff (1.9 kB) - added by mtredinnick on 07/05/07 02:58:27.
Broken patch that might act as inspiration.

Change History

07/05/07 02:54:55 changed by mtredinnick

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

Turns out there are two problems here: one with conversion on input and one with conversion on output. I didn't spot them originally because my database setup was using a sensible encoding. Configuring MySQL to use latin1 on the client side and an old MySQLdb(1.2.0) shows up the problem(s).

Fixing these is a little tricky. At the moment, I'm getting a weakref failure in the tests. I'll keep working on it in the background, but for the moment, you might not be able to use MySQL 100% reliably on Dreamhost. They really should install a non-broken MySQLdb.

07/05/07 02:58:27 changed by mtredinnick

  • attachment mysql_old.diff added.

Broken patch that might act as inspiration.

07/05/07 03:00:04 changed by mtredinnick

The attached patch might be useful for somebody else wanting to hammer on this. It currently passes all tests with MySQLdb-1.2.2 (the second branch of the if-statement) and fails a bunch of tests with

ReferenceError: weakly-referenced object no longer exists

under MySQLdb-1.2.0.

Trying to set {[{conn.charset='utf8'}}} at the marked spot fails in the same way.

07/05/07 05:29:00 changed by mtredinnick

[5617] has a test in it that demonstrates this problem. Passes with all backends except mysql_old.

07/06/07 03:04:04 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [5623]) Fixed #4770 -- Fixed some Unicode conversion problems in the mysql_old backend with old MySQLdb versions. Tested against 1.2.0, 1.2.1 and 1.2.1p2 with only expected failures.


Add/Change #4770 (mysql_old and tables in utf8_unicode_ci -- non-ascii chars problems)




Change Properties
Action