Describe the bug
I have an issue with decoding a kvaser device name with chinese characters.
It has the Device Name: Kvaser 立富L
When trying to connect it fails in in canlib.py
def get_channel_info(channel):
name = ctypes.create_string_buffer(80)
serial = ctypes.c_uint64()
number = ctypes.c_uint()
canGetChannelData(
channel,
canstat.canCHANNELDATA_DEVDESCR_ASCII,
ctypes.byref(name),
ctypes.sizeof(name),
)
canGetChannelData(
channel,
canstat.canCHANNELDATA_CARD_SERIAL_NO,
ctypes.byref(serial),
ctypes.sizeof(serial),
)
canGetChannelData(
channel,
canstat.canCHANNELDATA_CHAN_NO_ON_CARD,
ctypes.byref(number),
ctypes.sizeof(number),
)
return f"{name.value.decode('ascii')}, S/N {serial.value} (#{number.value + 1})"
To Reproduce
I'm not able to reproduce this error. On my computer it is replaced with '?' which is fine
My computer:
OS Name Microsoft Windows 11 Pro
Version 10.0.22621 Build 22621
User computer is unknown.
Additional context
OS and version: unknown
Python version: 3.7.9
python-can version: 4.1.0
python-can interface: Kvaser EAN: 73-30130-00435-1 (i think an older Kvaser leaf light)
Trace
File "python\lib\site-packages\can\interface.py", line 127, in new
File "python\lib\site-packages\can\interfaces\kvaser\canlib.py", line 441, in init
File "python\lib\site-packages\can\interfaces\kvaser\canlib.py", line 716, in get_channel_info
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc1 in position 7: ordinal not in range(128)
Describe the bug
I have an issue with decoding a kvaser device name with chinese characters.
It has the Device Name: Kvaser 立富L
When trying to connect it fails in in canlib.py
To Reproduce
I'm not able to reproduce this error. On my computer it is replaced with '?' which is fine
My computer:
OS Name Microsoft Windows 11 Pro
Version 10.0.22621 Build 22621
User computer is unknown.
Additional context
OS and version: unknown
Python version: 3.7.9
python-can version: 4.1.0
python-can interface: Kvaser EAN: 73-30130-00435-1 (i think an older Kvaser leaf light)
Trace
File "python\lib\site-packages\can\interface.py", line 127, in new
File "python\lib\site-packages\can\interfaces\kvaser\canlib.py", line 441, in init
File "python\lib\site-packages\can\interfaces\kvaser\canlib.py", line 716, in get_channel_info
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc1 in position 7: ordinal not in range(128)