Edgewall Software

Opened 14 years ago

Closed 14 years ago

#5500 closed defect (duplicate)

UTF-8 may not be correctly handled if using MySQL backend

Reported by: ambrose.li@… Owned by: Jonas Borgström
Priority: normal Milestone:
Component: general Version: 0.10.4
Severity: normal Keywords: mysql
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:


When using the MySQL backend with a server with no particular default character set configured, the database will be created with the character set created in the default of "latin1". This causes non-Latin1 UTF-8 support to silently fail, with the errors like the following logged (this example being Chinese in UTF-8):

/usr/lib/python2.4/site-packages/trac/db/util.py:50: Warning: Incorrect string value: '\xE9\x9B\x86\xE9\xAB\x94...' for column 'newvalue' at row 1
  return self.cursor.execute(sql_escape_percent(sql), args)

The symptom of this problem is that all non-Latin1 (actually Windows 1252) characters will preview correctly but will be saved as question marks.

The scripts to initialize the database should probably explicitly specify the character set (perhaps one script for pre-4.1 MySQL servers and another for 4.1 and later), or this should be mentioned in the documentation, or both.

Attachments (0)

Change History (4)

comment:1 by Christian Boos, 14 years ago

Keywords: mysql added

Where did we forget to say that only UTF-8 mysql databases are supported? Not in MySqlDb and not in DatabaseBackend

comment:2 by ambrose.li@…, 14 years ago

These pages will not be read by a casual installer, since they are not mentioned in TracUnicode (which is the only page linked to from the FAQ in the question about Unicode support).

comment:3 by anonymous, 14 years ago

Ok, TracUnicode mentions DatabaseBackend now.

Perhaps you can close my ticket as a dup of #4990. I'll update MySqlDb so that people searching for the error message can find it there.

comment:4 by ThurnerRupert, 14 years ago

Resolution: duplicate
Status: newclosed

of #4990, as requested :)

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.