projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bbe16ab
)
hwdb/parse_hwdb.py: open files with UTF-8 mode
author
Martin Pitt
<martin.pitt@ubuntu.com>
Thu, 24 Nov 2016 09:38:01 +0000
(10:38 +0100)
committer
Martin Pitt
<martin.pitt@ubuntu.com>
Thu, 24 Nov 2016 09:38:01 +0000
(10:38 +0100)
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.
hwdb/parse_hwdb.py
patch
|
blob
|
history
diff --git
a/hwdb/parse_hwdb.py
b/hwdb/parse_hwdb.py
index
5d4c5ea
..
556b859
100755
(executable)
--- a/
hwdb/parse_hwdb.py
+++ b/
hwdb/parse_hwdb.py
@@
-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 []