#2973 closed task (duplicate)
Error when adding a ticket (using Trac-Mysql DB ) - Illegal mix of collations
Reported by: | Owned by: | anonymous | |
---|---|---|---|
Priority: | highest | Milestone: | |
Component: | ticket system | Version: | devel |
Severity: | critical | Keywords: | ticket mysql Operational Error |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
Hi every one
I am using Trac with MySQL data base and I am getting an exception when I try to add a ticket. The Trace of the Exception is as followos:
Traceback (most recent call last): File "C:\engines\Python24\lib\site-packages\trac\web\main.py", line 283, in dispatch_request dispatcher.dispatch(req) File "C:\engines\Python24\lib\site-packages\trac\web\main.py", line 170, in dispatch resp = chosen_handler.process_request(req) File "C:\engines\Python24\lib\site-packages\trac\ticket\web_ui.py", line 219, in process_request self._insert_ticket_data(req, db, ticket, reporter_id) File "C:\engines\Python24\lib\site-packages\trac\ticket\web_ui.py", line 424, in _insert_ticket_data changelog = ticket.get_changelog(db=db) File "C:\engines\Python24\lib\site-packages\trac\ticket\model.py", line 271, in get_changelog "ORDER BY time", (self.id, str(self.id), self.id)) File "C:\engines\Python24\lib\site-packages\trac\db\util.py", line 47, in execute return self.cursor.execute(sql_escape_percent(sql), args) File "C:\engines\Python24\lib\site-packages\trac\db\util.py", line 47, in execute return self.cursor.execute(sql_escape_percent(sql), args) File "C:\engines\Python24\lib\site-packages\MySQLdb\cursors.py", line 137, in execute self.errorhandler(self, exc, value) File "C:\engines\Python24\lib\site-packages\MySQLdb\connections.py", line 33, in defaulterrorhandler raise errorclass, errorvalue OperationalError: (1267, "Illegal mix of collations (utf8_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation 'UNION'")
Thanks in advance
Attachments (0)
Change History (13)
comment:1 by , 19 years ago
Type: | defect → task |
---|
comment:2 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 19 years ago
Description: | modified (diff) |
---|
comment:4 by , 19 years ago
comment:5 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
This was solved in ticket #968
comment:6 by , 19 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Don't close a ticket as fixed unless some change has been committed to SVN. This should probably be a duplicate, since the problem has been address in the patches for #968.
comment:7 by , 19 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
Issue already raised in #968.
comment:8 by , 19 years ago
Milestone: | 2.0 |
---|
comment:10 by , 18 years ago
Milestone: | → 0.11 |
---|---|
Version: | 0.9.4 → devel |
I'm using a 11dev version checked out on 10-28-06. Not sure which version.
When I created my database in MySQL it defaulted to latin1_sweedish_ci charset instead of utf8 (which is normal for my setup). Heres what I did to make it work: I had to alter /usr/local/lib/python2.5/site-packages/trac/db/mysql_backend.py to the following in order to no longer throw the error mentioned above.
136 # python-mysqldb 1.2.1 added a 'charset' arg that is required for 137 # unicode stuff. We hack around that here for older versions; at 138 # some point, this hack should be removed, and a strict requirement 139 # on 1.2.1 made. -dilinger 140 if (self._mysqldb_gt_or_eq((1, 2, 1))): 141 #cnx = MySQLdb.connect(db=path, user=user, passwd=password, 142 # host=host, port=port, charset='utf8') 143 cnx = MySQLdb.connect(db=path, user=user, passwd=password, 144 host=host, port=port, charset='latin1') 145 else: 146 cnx = MySQLdb.connect(db=path, user=user, passwd=password, 147 host=host, port=port, use_unicode=True) 148 #self._set_character_set(cnx, 'utf8') 149 self._set_character_set(cnx, 'latin1')
comment:11 by , 18 years ago
Sorry about the formating above.
I'm using a 11dev version checked out on 10-28-06. Not sure which version.
When I created my database in MySQL it defaulted to latin1_sweedish_ci charset
instead of utf8 (which is normal for my setup).
Heres what I did to make it work:
I had to alter /usr/local/lib/python2.5/site-packages/trac/db/mysql_backend.py
to the following in order to no longer throw the error mentioned above.
136 # python-mysqldb 1.2.1 added a 'charset' arg that is required for
137 # unicode stuff. We hack around that here for older versions; at
138 # some point, this hack should be removed, and a strict requirement
139 # on 1.2.1 made. -dilinger
140 if (self._mysqldb_gt_or_eq((1, 2, 1))):
141 #cnx = MySQLdb.connect(db=path, user=user, passwd=password,
142 # host=host, port=port, charset='utf8')
143 cnx = MySQLdb.connect(db=path, user=user, passwd=password,
144 host=host, port=port, charset='latin1')
145 else:
146 cnx = MySQLdb.connect(db=path, user=user, passwd=password,
147 host=host, port=port, use_unicode=True)
148 #self._set_character_set(cnx, 'utf8')
149 self._set_character_set(cnx, 'latin1')
comment:12 by , 18 years ago
Hm, that's barely more readable ;) See TracDev/SubmittingPatches for some advices about how to produces patches.
IIUC, you said that setting the charset parameter to the same value is your server charset (latin1) in your case solved all the problems?
Please follow-up on #3182, I'd be interested to know if that solved all issues. In particular, what happens when using UTF-8 characters not part of the latin1 encoding, in that case.
E.g. try to insert some excerpts of TracUnicode in your tickets, and check how this behaves…
comment:13 by , 18 years ago
Milestone: | 0.11 |
---|
Sorry I forget to mention that Iam using the following versions: