Opened 18 years ago
Closed 18 years ago
#5500 closed defect (duplicate)
UTF-8 may not be correctly handled if using MySQL backend
Reported by: | 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: |
Description
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 , 18 years ago
Keywords: | mysql added |
---|
comment:2 by , 18 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 , 18 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.
Where did we forget to say that only UTF-8 mysql databases are supported? Not in MySqlDb and not in DatabaseBackend …