Skip to content

Commit

Permalink
Fix decode error when parsing EEPROM fields (#199)
Browse files Browse the repository at this point in the history
#### Description
Following error is seen while parsing EEPROM fields for few transceivers.
'utf-8' codec can't decode byte 0xff in position 6: invalid start byte

#### Motivation and Context
EEPROM fields will not be displayed  if unicode characters are not properly.
E.g. Vendor Date: 20'u-tf--8'
  • Loading branch information
aravindmani-1 authored and qiluo-msft committed Jun 21, 2021
1 parent 238d76b commit 67b8a77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sonic_platform_base/sonic_sfp/sffbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def convert_hex_to_string(self, arr, start, end):
ret_str = ''
for n in range(start, end):
ret_str += arr[n]
return binascii.unhexlify(ret_str).decode("utf-8").strip()
return binascii.unhexlify(ret_str).decode("utf-8", "ignore").strip()
except Exception as err:
return str(err)

Expand Down

0 comments on commit 67b8a77

Please sign in to comment.