diff options
Diffstat (limited to 'dev-python/icalendar/files/2.1_p20100409/05_all_utf8-multi-octet-fix.patch')
-rw-r--r-- | dev-python/icalendar/files/2.1_p20100409/05_all_utf8-multi-octet-fix.patch | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/dev-python/icalendar/files/2.1_p20100409/05_all_utf8-multi-octet-fix.patch b/dev-python/icalendar/files/2.1_p20100409/05_all_utf8-multi-octet-fix.patch new file mode 100644 index 00000000000..e0ac0cf3671 --- /dev/null +++ b/dev-python/icalendar/files/2.1_p20100409/05_all_utf8-multi-octet-fix.patch @@ -0,0 +1,30 @@ +From http://codespeak.net/pipermail/icalendar-dev/2010-April/000152.html: + +Lines get folded in the middle of multi-octet sequences (checked out +code from svn today). Consider this case: +import icalendar +ical = icalendar.Calendar() +ical.add('summary', u'a' + u'ą'*100) +ical.as_string().decode('utf-8') +... +UnicodeDecodeError: 'utf8' codec can't decode bytes in position 90-91: +invalid data + +I have attached a diff of a simple one-line fix. + +As I see in the code you actually try not to split a multi-octet +character but you don't recalculate the slice after finding the new +end position. Could you confirm this? + +Submitted by Rimvydas Naktinis. +=================================================================== +--- src/icalendar/parser.py (revision 73587) ++++ src/icalendar/parser.py (working copy) +@@ -456,6 +456,7 @@ + else: + end -= 1 + ++ slice = self[start:end] + new_lines.append(slice) + if end == l_line: + # Done |