mirror of
https://git.rtems.org/rtems-docs/
synced 2025-05-15 00:17:26 +08:00
waf/common: Fix UTF-8 encoding of HTML inliner output on Python3.
This commit is contained in:
parent
bb47f890c8
commit
c576e9bf0d
@ -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
|
# The inliner does not handle internal href's correctly and places the
|
||||||
# input's file name in the href. Strip these.
|
# input's file name in the href. Strip these.
|
||||||
#
|
#
|
||||||
with open(tgt, 'r') as i:
|
if sys.version_info[0] < 3:
|
||||||
before = i.read()
|
with open(tgt, 'r') as i:
|
||||||
after = before.replace('index.html', '')
|
before = i.read()
|
||||||
|
else:
|
||||||
|
with open(tgt, 'r', encoding = 'ascii', errors = 'surrogateescape') as i:
|
||||||
|
before = i.read()
|
||||||
i.close()
|
i.close()
|
||||||
with open(tgt, 'w') as o:
|
after = before.replace('index.html', '')
|
||||||
o.write(after)
|
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()
|
o.close()
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user