diff options
author | Chris Johns <chrisj@rtems.org> | 2019-10-29 13:37:43 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2019-10-29 13:37:43 +1100 |
commit | c576e9bf0df78f02fbf46e126aa7a8caae75b567 (patch) | |
tree | 9200267c61906b7f67907fe993e2b579907c349b | |
parent | user/rsb: Update 3rd party package build and add packaging details. (diff) | |
download | rtems-docs-c576e9bf0df78f02fbf46e126aa7a8caae75b567.tar.bz2 |
waf/common: Fix UTF-8 encoding of HTML inliner output on Python3.
-rw-r--r-- | common/waf.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/common/waf.py b/common/waf.py index d71541e..066048d 100644 --- a/common/waf.py +++ b/common/waf.py @@ -359,12 +359,20 @@ def doc_singlehtml(ctx, source_dir, conf_dir, sources): # The inliner does not handle internal href's correctly and places the # input's file name in the href. Strip these. # - with open(tgt, 'r') as i: - before = i.read() - after = before.replace('index.html', '') + if sys.version_info[0] < 3: + with open(tgt, 'r') as i: + before = i.read() + else: + with open(tgt, 'r', encoding = 'ascii', errors = 'surrogateescape') as i: + before = i.read() i.close() - with open(tgt, 'w') as o: - o.write(after) + after = before.replace('index.html', '') + if sys.version_info[0] < 3: + with open(tgt, 'w') as o: + o.write(after) + else: + with open(tgt, 'w', encoding = 'ascii', errors = 'surrogateescape') as o: + o.write(after) o.close() return r |