python-OBD icon indicating copy to clipboard operation
python-OBD copied to clipboard

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

Open gwillgues opened this issue 1 year ago • 1 comments

When retrieving VIN via the following example code, I received 16 characters instead of the proper 17, and the trailing "0" in my VIN was truncated.

connection = obd.OBD()

cmd = obd.commands.VIN
response = connection.query(cmd)
print(response.value)

I modified decode_encoded_string() in decoders.py to use the .replace() function instead of .strip() to remove '\x00', '\x01', and '\x02', which resolved the issue in my testing.

gwillgues avatar May 04 '24 20:05 gwillgues

@brendan-w Did you have a chance to review this?

gwillgues avatar Apr 13 '25 14:04 gwillgues