mirror of
https://github.com/systemd/systemd.git
synced 2025-02-25 21:57:32 +03:00
hwdb/parse_hwdb.py: open files with UTF-8 mode
pyparsing uses the system locale by default, which in the case of 'C' (in lots of build environment) will fail with a UnicodeDecodeError. Explicitly open it with UTF-8 encoding to guard against this.
This commit is contained in:
parent
bbe16abb61
commit
115a10c58d
@ -133,7 +133,8 @@ def convert_properties(group):
|
||||
def parse(fname):
|
||||
grammar = hwdb_grammar()
|
||||
try:
|
||||
parsed = grammar.parseFile(fname)
|
||||
with open(fname, 'r', encoding='UTF-8') as f:
|
||||
parsed = grammar.parseFile(f)
|
||||
except ParseBaseException as e:
|
||||
error('Cannot parse {}: {}', fname, e)
|
||||
return []
|
||||
|
Loading…
x
Reference in New Issue
Block a user