Skip to content

Commit

Permalink
Fix truncation of last character of VIN number by modifying decode_en…
Browse files Browse the repository at this point in the history
…coded_string function to use .replace() instead of .strip()
  • Loading branch information
gwillgues committed May 4, 2024
1 parent e0304c3 commit 090b66a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion obd/decoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ def decode_encoded_string(messages, length):
# Encoded strings come in bundles of messages with leading null values to
# pad out the string to the next full message size. We strip off the
# leading null characters here and return the resulting string.
return d.strip().strip(b'\x00' b'\x01' b'\x02' b'\\x00' b'\\x01' b'\\x02')
decoded_string = d.strip().replace(b'\x00', b'').replace(b'\x01', b'').replace(b'\x02', b'').replace(b'\\x00', b'').replace(b'\\x01', b'').replace(b'\\x02', b'')
return decoded_string


def cvn(messages):
Expand Down

0 comments on commit 090b66a

Please sign in to comment.