#7626 closed defect (fixed)
display of some wiki pages fails with UnicodeDecodeError
Reported by: | Owned by: | anonymous | |
---|---|---|---|
Priority: | normal | Milestone: | not applicable |
Component: | general | Version: | 0.11 |
Severity: | normal | Keywords: | mysql documentation |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
After creating a new trac project, setting everything up and navigating to wiki/CamelCase (or wiki/TracCgi or wiki/TracChangeset or a few other pages that contain non-ASCII characters) I get this error:
UnicodeDecodeError: 'ascii' codec can't decode byte ... in position ...: ordinal not in range(128)
(with some actual numbers instead of …'s.)
Here is the system information provided by the trac About page:
Trac: 0.11 Python: 2.4.4 (#1, Apr 15 2008, 23:37:53) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] setuptools: 0.6c8 MySQL: server: "5.0.32-Debian_7etch6-log", client: "5.0.32", thread-safe: 0 MySQLdb: 1.2.2 Genshi: 0.5.1 mod_python: 3.2.10 Subversion: 1.4.2 (r22196) jQuery: 1.2.3
The steps I took in order to produce this bug on the system described above:
- created a MySQL database for trac in the recommended fashion:
CREATE DATABASE trac_support DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
- granted rights to a user called `trac' for the newly created database:
GRANT ALL ON trac_support.* TO trac;
- created a new trac project:
trac-admin /var/trac/support initenv
- granted rights to the project path for the www-data user:
chown -R www-data:www-data /var/trac/support
- configured apache2 as follows:
<VirtualHost ...> [...] <Location /support> SetHandler mod_python PythonInterpreter main_interpreter PythonHandler trac.web.modpython_frontend PythonOption TracEnv /var/trac/support PythonOption TracUriRoot /support </Location> <Location /support/login> AuthType Basic AuthName "support" AuthUserFile /var/trac/support/.htpasswd Require valid-user </Location> [...] </VirtualHost>
- restarted Apache and navigated to the webpage <URL>/support/wiki/TracCgi
At this point, I get the following error:
Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/web/main.py", line 423, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/web/main.py", line 219, in dispatch data, content_type) File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/web/chrome.py", line 726, in render_template stream.render(method, doctype=doctype, out=buffer) File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 179, in render File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/output.py", line 61, in encode File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/output.py", line 311, in __call__ File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/output.py", line 753, in __call__ File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/output.py", line 592, in __call__ File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/output.py", line 698, in __call__ File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/output.py", line 532, in __call__ File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 283, in _ensure File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 283, in _ensure File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/web/chrome.py", line 779, in _strip_accesskeys for kind, data, pos in stream: File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 283, in _ensure File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/web/chrome.py", line 768, in _generate for kind, data, pos in stream: File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 569, in _include File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/markup.py", line 298, in _match File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/markup.py", line 298, in _match File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/markup.py", line 245, in _match File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 543, in _exec File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 533, in _eval File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 496, in _eval File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 551, in _flatten File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 283, in _ensure File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/path.py", line 141, in _generate File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 569, in _include File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/markup.py", line 234, in _strip File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 543, in _exec File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 533, in _eval File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 496, in _eval File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 551, in _flatten File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 283, in _ensure File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/path.py", line 141, in _generate File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 569, in _include File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/markup.py", line 234, in _strip File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 543, in _exec File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 520, in _eval File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 286, in _eval_expr File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/eval.py", line 180, in evaluate File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/templates/wiki_view.html", line 37, in <Expression u'wiki_to_html(context, page.text)'> ${wiki_to_html(context, page.text)} File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/util/compat.py", line 133, in newfunc return func_(*(args + fargs), **dict(kwargs, **fkwargs)) File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/formatter.py", line 1095, in format_to_html return HtmlFormatter(env, context, wikidom).generate(escape_newlines) File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/formatter.py", line 1054, in generate escape_newlines) File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/wiki/formatter.py", line 862, in format result = re.sub(self.wikiparser.rules, self.replace, line) File "sre.py", line 142, in sub return _compile(pattern, 0).sub(repl, string, count) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 21: ordinal not in range(128)
Attachments (0)
Change History (6)
comment:1 by , 16 years ago
Component: | wiki system → general |
---|---|
Keywords: | mysql documentation needinfo added |
Milestone: | → 0.11.2 |
comment:4 by , 16 years ago
Keywords: | needinfo removed |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Thanks for the feedback! I updated the doc in MySqlDb@25.
comment:5 by , 16 years ago
Milestone: | 0.11.2 → not applicable |
---|
(since that documentation is not bundled)
comment:6 by , 16 years ago
Owner: | set to |
---|
I think that the
utf8_bin
advice from MySqlDb actually applies to 0.11.1, not to 0.11 (jonas correct me if I'm wrong). This should be made clearer.Please tell us if the upgrade to 0.11.1 fixed your problem.