Fixed string conversion from bytes

This commit is contained in:
Paul Glaß 2022-09-02 15:23:59 +02:00 committed by Dominik Pataky
parent affef1a972
commit 88f864036b

View file

@ -770,7 +770,7 @@ class IPFIXDataRecord:
if type(value) is bytes:
# Check if value is raw bytes, so no conversion happened in struct.unpack
if field_datatype in ["string"]:
value = str(value)
value = value.decode()
# TODO: handle octetArray (= does not have to be unicode encoded)
elif field_datatype in ["boolean"]:
value = True if value == 1 else False # 2 = false per RFC