Skip to content

Commit 090b66a

Browse files
committed
Fix truncation of last character of VIN number by modifying decode_encoded_string function to use .replace() instead of .strip()
1 parent e0304c3 commit 090b66a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

obd/decoders.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,8 @@ def decode_encoded_string(messages, length):
505505
# Encoded strings come in bundles of messages with leading null values to
506506
# pad out the string to the next full message size. We strip off the
507507
# leading null characters here and return the resulting string.
508-
return d.strip().strip(b'\x00' b'\x01' b'\x02' b'\\x00' b'\\x01' b'\\x02')
508+
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'')
509+
return decoded_string
509510

510511

511512
def cvn(messages):

0 commit comments

Comments
 (0)