#9690 closed defect (fixed)
bugzilla2trac.py chokes on Unicode (UTF-8) or localized data
| Reported by: | Owned by: | ||
|---|---|---|---|
| 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: | |||
Description
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
comp['owner'].encode('utf-8')))
…
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)
Change History (5)
by , 15 years ago
| Attachment: | bugzilla2trac.py.patch added |
|---|
comment:1 by , 15 years ago
| Milestone: | → 0.12.2 |
|---|---|
| Owner: | set to |
We really need someone to take care of those importers. Thanks for the patch!
follow-up: 4 comment:2 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Patch applied in [10233], thanks!
comment:3 by , 15 years ago
| Owner: | changed from to |
|---|



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