Opened 15 years ago
Closed 14 years ago
#6908 closed defect (duplicate)
[patch] Tagged pages with names containing non-ASCII chars break listing for their tags
Reported by: | Owned by: | Alec Thomas | |
---|---|---|---|
Priority: | normal | Component: | TagsPlugin |
Severity: | normal | Keywords: | unicode |
Cc: | Trac Release: | 0.12 |
Description
I love to use Trac and the Tag Plugin. As I use different languages for some pages I have pages which have non ascii characters (Umlauts) in some names. If these pages are tagged as well, they break the listing of pages having the same tags.
Reproduce
Create a page named PageWithUmlaut_Ü? with the content
[[ListTagged(ReproduceTag)]]
and tag it with ReproduceTag
.
Saving it you get
Error: Macro ListTagged(ReproduceTag) failed asciiPageWithUmlaut_Ü1516ordinal not in range(128)
instead the list of tagged pages.
And as well in [tags?q='ReproduceTag']
Trac detected an internal error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xdc' in position 15: ordinal not in range(128)
This happens in ListTaggedMacro.expand_macro()
in sorted()
when applying str()
to the unicode id.
Simply removing the str()
fixes the issue
but messes up the sorting of the pages.
I don't understand why the problem occurs in the first place
(and why I get two different error messages).
I expected str()
to work on UTF8.
Setting default_charset = utf-8
in the trac.ini didn't help.
Nevertheless I attached the patch.
Attachments (1)
Change History (6)
Changed 15 years ago by
Attachment: | listTaggedWithUmlaut.patch added |
---|
comment:1 Changed 15 years ago by
I forgot the version Trac: 0.11.7 Python: 2.5.4 (r254:67916, Feb 11 2010, 00:50:55) [GCC 4.2.1 (Apple Inc. build 5646)] Genshi: 0.5.1
but I believe I see the same problem as well on Trac: 0.12dev-r8263 Python: 2.4.4 (#1, Oct 22 2008, 20:17:05) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] (but as that is my production wiki I didn't look so closely into it there)
comment:2 Changed 15 years ago by
I have the same problem for wiki with name in Chinese. Trac 0.11.1
comment:3 follow-up: 5 Changed 15 years ago by
the patch works! http://trac-hacks.org/attachment/ticket/6908/listTaggedWithUmlaut.patch
Thanks a lot
comment:4 Changed 14 years ago by
Summary: | Tagged pages with names containing non ascii characters break the listing for their tags → [Patch] Tagged pages with names containing non ascii characters break the listing for their tags |
---|---|
Trac Release: | 0.11 → 0.12 |
comment:5 Changed 14 years ago by
Keywords: | unicode added; encoding removed |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
Summary: | [Patch] Tagged pages with names containing non ascii characters break the listing for their tags → [patch] Tagged pages with names containing non-ASCII chars break listing for their tags |
Replying to lndr:
the patch works! http://trac-hacks.org/attachment/ticket/6908/listTaggedWithUmlaut.patch
Thanks a lot
Nevertheless it's certainly not the preferred way to fix this issue.
I've seen, this issue has been fixed in trunk with changeset [3875] more than 2 years ago (see #2493), and missing backport to other branches has already be reported with #5575 as well.
So let's only keep one ticket open for tracking the remaining work. Anyway, thank you for taking your time to report and suggest a solution.
Patch from within tagsplugin/tags/0.6