diff --git a/onepif/OnepifEntry.py b/onepif/OnepifEntry.py index 417947f..3734baf 100644 --- a/onepif/OnepifEntry.py +++ b/onepif/OnepifEntry.py @@ -130,6 +130,9 @@ class OnepifEntry(): continue propname = f["designation"] propval = f["value"] + if type(propval) is str: + # For some reason 1P sometimes exports 0x10 character for empty strings + propval = propval.replace("\x10", "") if f["type"] not in ["T", "P", "E"]: raise Exception("Unknown field type discovered: {}".format(f["type"])) self.add_with_unique_key(target_dict, propname, propval) @@ -157,6 +160,9 @@ class OnepifEntry(): while new_key2 in props: suffix_ctr2 += 1 new_key2 = "{}_{}".format(k2, suffix_ctr2) + if type(v2) is str: + # For some reason 1P sometimes exports 0x10 character for empty strings + v2 = v2.replace("\x10", "") props[new_key2] = v2 continue new_key = k @@ -164,6 +170,9 @@ class OnepifEntry(): while new_key in props: suffix_ctr += 1 new_key = "{}_{}".format(k, suffix_ctr) + if type(v) is str: + # For some reason 1P sometimes exports 0x10 character for empty strings + v = v.replace("\x10", "") props[new_key] = v # TODO: Maybe walk all keys and see if there's (xxx_dd), xxx_mm, xxx_yy and turn them into a date return props