diff options
author | Matthew Peveler <matt.peveler@gmail.com> | 2020-06-26 20:06:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-26 20:06:47 +0300 |
commit | 334b4aed32f5e1b0952445b3b4e6b3e133063565 (patch) | |
tree | 08364947610f84150c8e701478b94461acfb39b9 | |
parent | d104c91373704d98f53d12a07ae8290e58cbac48 (diff) | |
download | asciidoc-py3-334b4aed32f5e1b0952445b3b4e6b3e133063565.tar.gz |
fix a2x failing on parsing encoding of html files (#125)
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
-rwxr-xr-x | a2x.py | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -303,6 +303,8 @@ def find_resources(files, tagname, attrname, filter=None): with open(filename, 'rb') as open_file: contents = open_file.read() mo = re.search(b'\A<\?xml.* encoding="(.*?)"', contents) + if mo is None: + mo = re.search(br'<meta http\-equiv="Content\-Type" content="text\/html; charset=(.*?)">', contents) contents = contents.decode(mo.group(1).decode('utf-8') if mo else 'utf-8') parser.feed(contents) parser.close() |