Menu

Commit [r3236]  Maximize  Restore  History

Wiki headings containing some special characters could

trigger an `UnicodeDecodeError: ... unexpected end of data`.

For example, the character `LATIN SMALL LETTER A WITH GRAVE`
is encoded in UTF-8 using the 2 bytes sequence `'\xc3\xa0'`.

Depending on the current locale, the `splitlines` function
used in `wiki_to_oneliner` might interpret the single byte
`'\xa0'` as a `NO-BREAK SPACE` (in most of the ''iso-8859''
and a lot of the ''cp'' encodings).
This splits the utf-8 encoded string right in the middle of
a two bytes sequence, which will later trigger the above exception.

Therefore we temporarily use `unicode` objects before
doing the `splitlines`.

Of course, this is only relevant for [milestone:0.9],
as since [milestone:0.10], `unicode` objects are used
internally.

Fixes #3058.

cboos 2006-04-22

changed /branches/0.9-stable/trac/wiki/formatter.py
changed /branches/0.9-stable/trac/wiki/tests/wiki-tests.txt
/branches/0.9-stable/trac/wiki/formatter.py Diff Switch to side-by-side view
Loading...
/branches/0.9-stable/trac/wiki/tests/wiki-tests.txt Diff Switch to side-by-side view
Loading...
MongoDB Logo MongoDB