Skip to content
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

UnicodeDecodeError: 'ascii' codec can't decode byte 0x90 in position 3: ordinal not in range(128) #186

Open
hattaagung opened this issue Jul 21, 2024 · 0 comments

Comments

@hattaagung
Copy link

Hi,

try decode ASN1 BER file with ASN1 schema but failing with error like below

Traceback (most recent call last):
File "C:\Users\ehatagu\PYTHON\ASN1BER\occcdrdecode3.py", line 16, in
decoded_record, record_length = schema.decode_with_length('ChargingDataOutputRecord', file_data[index:])
File "C:\Python310\lib\site-packages\asn1tools\compiler.py", line 188, in decode_with_length
decoded, length = type_.decode_with_length(data)
File "C:\Python310\lib\site-packages\asn1tools\codecs\ber.py", line 1559, in decode_with_length
decoded, offset = self._type.decode(bytearray(data), 0)
File "C:\Python310\lib\site-packages\asn1tools\codecs\ber.py", line 1227, in decode
decoded, offset = member.decode(data, offset)
File "C:\Python310\lib\site-packages\asn1tools\codecs\ber.py", line 551, in decode
return self.decode_content(data, offset, length)
File "C:\Python310\lib\site-packages\asn1tools\codecs\ber.py", line 755, in decode_content
offset, out_of_data = self.decode_members(self.root_members, data, values, offset, end_offset) File "C:\Python310\lib\site-packages\asn1tools\codecs\ber.py", line 802, in decode_members
value, offset = member.decode(data, offset, values=values)
File "C:\Python310\lib\site-packages\asn1tools\codecs\ber.py", line 635, in decode
return self.decode_primitive_contents(data, offset, length), end_offset
File "C:\Python310\lib\site-packages\asn1tools\codecs\ber.py", line 677, in decode_primitive_contents
return data[offset:offset + length].decode(self.ENCODING)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x90 in position 3: ordinal not in range(128)

Thanks,
Hatta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant