Commit 78bc7699 authored by Nicolas Delaby's avatar Nicolas Delaby

Handle case when text_content does not match pattern

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34378 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d2a5fecd
......@@ -230,7 +230,9 @@ class TextDocument(Document, TextContent):
mime_type = 'text/x-html-safe'
if charset is None:
# find charset
charset = self.charset_parser.search(text_content).group('charset')
re_match = self.charset_parser.search(text_content)
if re_match is not None:
charset = re_match.group('charset')
if charset and charset not in ('utf-8', 'UTF-8'):
try:
text_content = text_content.decode(charset).encode('utf-8')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment