Commit 46e23582 authored by Yusei Tahara's avatar Yusei Tahara

convert to utf8 text, if possible. original text might not be utf8 encoding.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18083 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 62b20acc
......@@ -350,13 +350,10 @@ class OOoDocument(File, ConversionCacheMixin):
is_html = 1
elif format in ('txt', 'text', 'text-content'):
format_list = self.getTargetFormatList()
if format in format_list:
format = format_list[format_list.index(format)]
if 'txt' in format_list:
format = format_list[format_list.index('txt')]
elif 'text' in format_list:
format = format_list[format_list.index('text')]
else:
# if possible, we try to get utf8 text. ('enc.txt' will encode to utf8)
if 'enc.txt' in format_list:
format = 'enc.txt'
elif format not in format_list:
return 'text/plain', self.asTextContent()
# Raise an error if the format is not supported
if not self.isTargetFormatAllowed(format):
......
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