Edgewall Software

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#9690 closed defect (fixed)

bugzilla2trac.py chokes on Unicode (UTF-8) or localized data

Reported by: jackqq@… Owned by: jackqq@…
Priority: normal Milestone: 0.12.2
Component: contrib Version: 0.12-stable
Severity: major Keywords: patch, windows, unicode, pysqlite, CJK
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:


System Information:

Windows 7 Python 2.7 Trac 0.12 MySQL-python-1.2.3 MySQL Essential 5.0.90 bugzilla2trac.py [10009]

I am migrating from a Bugzilla with bugs written in Chinese, MySQL database encoded in UTF-8. The Trac instance is on an SQLite DB.

At first, bugzilla2trac finished very quickly, without importing any bugs. It showed the product names as question marks. I added charset='utf8' to the MySQL connection string, and the products were displayed well.

Then, at the beginning of '7. Import bugs and bug activity…', bugzilla2trac failed with the following traceback.

Traceback (most recent call last):
File “C:\Users\jackqq\Desktop\bugzilla2trac.py”, line 301, in setComponentList
sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a 
text_factory that can interpret 8-bit bytestrings (like text_factory = str). 
It is highly recommended that you instead just switch your application to 
Unicode strings.

I tried removing all the calls to encode('utf-8'), and bugzilla2trac started to import successfully.

Hope this tip helps those with CJK chars in their Bugzilla DBs.

Attachments (1)

bugzilla2trac.py.patch (5.0 KB ) - added by jackqq@… 12 years ago.
Importing UTF-8 encoded Bugzilla DB with bugs written in Chinese.

Download all attachments as: .zip

Change History (5)

by jackqq@…, 12 years ago

Attachment: bugzilla2trac.py.patch added

Importing UTF-8 encoded Bugzilla DB with bugs written in Chinese.

comment:1 by Remy Blank, 12 years ago

Milestone: 0.12.2
Owner: set to Remy Blank

We really need someone to take care of those importers. Thanks for the patch!

comment:2 by Remy Blank, 12 years ago

Resolution: fixed
Status: newclosed

Patch applied in [10233], thanks!

comment:3 by Remy Blank, 12 years ago

Owner: changed from Remy Blank to jackqq@…

in reply to:  2 comment:4 by jackqq@…, 12 years ago

Thanks for the rapid adoption. It's my pleasure to share. :)

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain jackqq@….
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from jackqq@… 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.