Skip to content

Fix truncation of last character of VIN by modifying decode_encoded_string() #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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