summaryrefslogtreecommitdiff
path: root/a2x.py
diff options
context:
space:
mode:
authorStuart Rackham <srackham@methods.co.nz>2010-10-18 12:46:10 +1300
committerStuart Rackham <srackham@methods.co.nz>2010-10-18 12:46:10 +1300
commit96628d39efe4595cc320811efc500f1c38ed1d55 (patch)
treef8f397e10bde7465687577f3521a8b6124173863 /a2x.py
parentee4f6d028a8885f80d586655e3e20d2519010015 (diff)
downloadasciidoc-96628d39efe4595cc320811efc500f1c38ed1d55.tar.gz
FIXED: ``UnicodeDecodeError: 'ascii' codec can't decode byte''. This error is
due to a limitation in the Python HTMLParser module, see: http://bugs.python.org/issue3932 Resolved by assuming UTF-8 input (this assumption is not always going be correct but it will be correct more often that not doing anything and assuming an ascii encoding.
Diffstat (limited to 'a2x.py')
-rwxr-xr-xa2x.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/a2x.py b/a2x.py
index cd95c99..8ec66c4 100755
--- a/a2x.py
+++ b/a2x.py
@@ -237,7 +237,9 @@ def find_resources(files, tagname, attrname, filter=None):
if OPTIONS.dry_run:
continue
parser = FindResources()
- parser.feed(open(f).read())
+ # UTF-8 is a better bet than the default ASCII.
+ # See http://bugs.python.org/issue3932
+ parser.feed(open(f).read().decode('utf8'))
parser.close()
result = list(set(result)) # Drop duplicate values.
result.sort()