When I try to use a database with collation "utf8_general_ci" with trac-
admin, I get the following error:
{{{
Failed to create environment. (1071, 'Specified key was too long; max key
length is 1000 bytes')
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/trac/scripts/admin.py", line 611,
in do_initenv
options=options)
File "/usr/lib/python2.3/site-packages/trac/env.py", line 124, in
__init__
self.create(options)
File "/usr/lib/python2.3/site-packages/trac/env.py", line 228, in create
DatabaseManager(self).init_db()
File "/usr/lib/python2.3/site-packages/trac/db/api.py", line 65, in
init_db
connector.init_db(**args)
File "/usr/lib/python2.3/site-packages/trac/db/mysql_backend.py", line
50, in init_db
cursor.execute(stmt)
File "/usr/lib/python2.3/site-packages/trac/db/util.py", line 48, in
execute
return self.cursor.execute(sql)
File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", line 137, in
execute
self.errorhandler(self, exc, value)
File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line 33,
in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1071, 'Specified key was too long; max key length is
1000 bytes')
Failed to initialize environment. 1
}}}
So, using collation "utf8_general_ci" trac-admin cannot create the
environment. However, using collation "latin1_general_ci", trac-admin is
able to finish it's work.
But: while viewing tickets, I get the following error:
{{{
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 335, in
dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 220, in
dispatch
resp = chosen_handler.process_request(req)
File "/usr/lib/python2.3/site-packages/trac/ticket/web_ui.py", line 287,
in process_request
get_reporter_id(req, 'author'))
File "/usr/lib/python2.3/site-packages/trac/ticket/web_ui.py", line 600,
in _insert_ticket_data
for change in self.grouped_changelog_entries(ticket, db):
File "/usr/lib/python2.3/site-packages/trac/ticket/web_ui.py", line 647,
in grouped_changelog_entries
changelog = ticket.get_changelog(when=when, db=db)
File "/usr/lib/python2.3/site-packages/trac/ticket/model.py", line 297,
in get_changelog
"ORDER BY time", (self.id, str(self.id), self.id))
File "/usr/lib/python2.3/site-packages/trac/db/util.py", line 47, in
execute
return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/lib/python2.3/site-packages/trac/db/util.py", line 47, in
execute
return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", line 137, in
execute
self.errorhandler(self, exc, value)
File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line 33,
in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1267, "Illegal mix of collations
(latin1_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation
'UNION'")
}}}
To summarize:
* latin1_general_ci: I can create the environment but I cannot view
tickets
* utf8_general_ci: I cannot create the environment
--
Ticket URL: <http://trac.edgewall.org/ticket/3659>
The Trac Project <http://trac.edgewall.org/>
Quick fix:
{{{
--- mysql_backend.py.BAK 2006-09-03 20:43:48.580402627 +0200
+++ mysql_backend.py 2006-09-03 20:53:32.394345764 +0200
@@ -141,7 +141,7 @@
else:
cnx = MySQLdb.connect(db=path, user=user, passwd=password,
host=host, port=port, use_unicode=True)
- self._set_character_set(cnx, 'utf8')
+ self._set_character_set(cnx, 'latin1')
ConnectionWrapper.__init__(self, cnx)
def cast(self, column, type):
}}}
--
Ticket URL: <http://trac.edgewall.org/ticket/3659#comment:1>
I just created another project. Using latin1 I was not able to create the
project, I had to use utf8. But afterwards, I needed to switch to latin1
in order to view the tickets. Very strange... (?)
--
Ticket URL: <http://trac.edgewall.org/ticket/3659#comment:2>
See #3673
--
Ticket URL: <http://trac.edgewall.org/ticket/3659#comment:3>
* keywords: => mysql utf8
--
Ticket URL: <http://trac.edgewall.org/ticket/3659#comment:4>
* summary: View Ticket does not work properly with MySQL =>
smart+question
Comment:
hello guys! http://hometown.aol.com/skylineblog/
--
Ticket URL: <http://trac.edgewall.org/ticket/3659#comment:5>