[patch] Tagged pages with names containing non-ASCII chars break listing for their tags
|Reported by:||claudius.link@…||Owned by:||athomas|
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.
Create a page named PageWithUmlaut_Ü? with the content
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.
Change History (6)
Changed 7 years ago by claudius.link@…
comment:4 Changed 6 years ago by rjollos
- Summary changed from Tagged pages with names containing non ascii characters break the listing for their tags to [Patch] Tagged pages with names containing non ascii characters break the listing for their tags
- Trac Release changed from 0.11 to 0.12
comment:5 in reply to: ↑ 3 Changed 6 years ago by hasienda
- Keywords unicode added; encoding removed
- Resolution set to duplicate
- Status changed from new to closed
- Summary changed from [Patch] Tagged pages with names containing non ascii characters break the listing for their tags to [patch] Tagged pages with names containing non-ASCII chars break listing for their tags