mirror of
https://opendev.org/x/pyghmi
synced 2025-01-28 11:57:34 +00:00
Merge "Workaround likely spec deviations and fix parsing"
This commit is contained in:
commit
f9702d902f
@ -214,9 +214,16 @@ class FRU(object):
|
||||
# return it as a bytearray, not much to be done for it
|
||||
return retinfo, newoffset
|
||||
elif currtype == 3: # text string
|
||||
if lang == 0:
|
||||
# Sometimes BMCs have FRU data with 0xff termination
|
||||
# contrary to spec, but can be tolerated
|
||||
# also in case something null terminates, handle that too
|
||||
# strictly speaking, \xff should be a y with diaeresis, but
|
||||
# erring on the side of that not being very relevant in practice
|
||||
# to fru info, particularly the last values
|
||||
retinfo = retinfo.rstrip('\xff\x00 ')
|
||||
if lang in (0, 25):
|
||||
try:
|
||||
retinfo = retinfo.decode('utf-8')
|
||||
retinfo = retinfo.decode('iso-8859-1')
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user