Modify ↓
Opened 9 years ago
Closed 9 years ago
#12422 closed defect (fixed)
Source inclusion of restructured text fails with encoding error
Reported by: | anonymous | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | IncludeMacro |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description (last modified by )
Consider a restructured text file held in the project repository, correctly MIME typed.
Now include in a wiki page: [[Include(source:Project/branches/development/example.rst)]]
The result is:
Error: Macro Include(source:Project/branches/development/example.rst) failed source returned bytes, but no encoding specified
Attachments (0)
Change History (5)
comment:2 Changed 9 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 9 years ago by
The following patch seems to fix the issue:
-
trunk/includemacro/macros.py
20 20 from trac.perm import IPermissionRequestor 21 21 from trac.resource import ResourceNotFound 22 22 from trac.ticket.model import Ticket 23 from trac.util.text import to_unicode 23 24 from trac.versioncontrol.api import NoSuchNode, RepositoryManager 24 25 from trac.wiki.api import WikiSystem 25 26 from trac.wiki.formatter import system_message … … 154 155 155 156 # Escape if needed 156 157 if not self.config.getbool('wiki', 'render_unsafe_content', False): 158 out = to_unicode(out) 157 159 try: 158 160 out = HTMLParser(StringIO(out)).parse() | HTMLSanitizer() 159 161 except ParseError:
comment:4 Changed 9 years ago by
Description: | modified (diff) |
---|---|
Status: | new → accepted |
Summary: | Source inclusion of restructured text failes with encoding error → Source inclusion of restructured text fails with encoding error |
Note: See
TracTickets for help on using
tickets.
From investigating the error message it looks like this may well be due to a change in the Genshi library. See trac:wiki:TracDev/ApiChanges/1.0#Genshimandatory