mirror of
https://github.com/systemd/systemd.git
synced 2025-03-28 02:50:16 +03:00
build-sys: force Python to write UTF-8
Here is a patch that fixes documentation with python 3.x in non utf-8 locales. Specifically in my locale latin-1 is the default setting for output going to stdout, which causes it to fail. By writing directly to file we are able to set the locale to utf-8.
This commit is contained in:
parent
1a13e31d27
commit
95e3faefe2
@ -28,7 +28,8 @@ try:
|
||||
_parser = tree.XMLParser()
|
||||
_parser.resolvers.add(CustomResolver())
|
||||
xml_parse = lambda page: tree.parse(page, _parser)
|
||||
xml_print = lambda xml: tree.tostring(xml, pretty_print=True)
|
||||
xml_print = lambda xml: tree.tostring(xml, pretty_print=True,
|
||||
encoding='utf-8')
|
||||
except ImportError:
|
||||
import xml.etree.ElementTree as tree
|
||||
import re as _re
|
||||
@ -37,4 +38,4 @@ except ImportError:
|
||||
def xml_parse(page):
|
||||
s = _re.sub(b'&[a-zA-Z0-9_]+;', b'', open(page, 'rb').read())
|
||||
return tree.parse(_io.BytesIO(s))
|
||||
xml_print = tree.tostring
|
||||
xml_print = lambda xml: tree.tostring(xml, encoding='utf-8')
|
||||
|
Loading…
x
Reference in New Issue
Block a user