提交 828371ab 编写于 作者: A Andrea Frittoli 提交者: tekton-robot

Try utf-8 first when decoding text

There is a chance that utf-8 encoded text may be decoded
successfully but wrongly as ascii. UTF-8 instead should always be
able to decode ascii successfully, so let's try UTF-8 first.

Fixes: #211
Signed-off-by: NAndrea Frittoli <andrea.frittoli@gmail.com>
上级 4677778c
......@@ -186,7 +186,7 @@ def transform_doc(doc, source_folder, target, target_folder, header,
return target
def decode(s, encodings=('ascii', 'utf8', 'latin1')):
def decode(s, encodings=('utf8', 'latin1', 'ascii')):
for encoding in encodings:
try:
return s.decode(encoding)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册