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 during creation of the D2SFile object #1

Open
artcom-net opened this issue Oct 7, 2020 · 2 comments
Open

UnicodeDecodeError during creation of the D2SFile object #1

artcom-net opened this issue Oct 7, 2020 · 2 comments
Assignees
Labels
bug Something isn't working fixed_in_dev This issue was fixed in the dev branch

Comments

@artcom-net
Copy link
Owner

Python 3.8.5 (default, Aug 29 2020, 03:09:06)

from d2lib.files import D2SFile
D2SFile('Ozzaki.d2s')
Traceback (most recent call last):
File "", line 1, in
File "/home/john/.local/lib/python3.8/site-packages/d2lib/files.py",
line 226, in init self._parse_header()
File "/home/john/.local/lib/python3.8/site-packages/d2lib/files.py",
line 318, in _parse_header self.char_name =
self._reader.read(16).rstrip(b'\x00').decode('ASCII')
UnicodeDecodeError: 'ascii' codec can't decode byte 0x82 in position
12: ordinal not in range(128)

@artcom-net artcom-net self-assigned this Oct 7, 2020
@artcom-net
Copy link
Owner Author

This is not a problem. The character name consists of 16 bytes that are encoded as ASCII. Anyway it is necessary to handle this case and throw D2SFileParseError as other cases do.

@artcom-net artcom-net added bug Something isn't working and removed analysis labels Oct 9, 2020
artcom-net added a commit that referenced this issue Oct 9, 2020
Wrap the UnicodeDecodeError exception and throw D2SFileParseError instead.
Fixes #1
@artcom-net
Copy link
Owner Author

Will be merged into master in version 1.0.0

@artcom-net artcom-net added v1.0.0 fixed_in_dev This issue was fixed in the dev branch and removed v1.0.0 labels Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed_in_dev This issue was fixed in the dev branch
Projects
None yet
Development

No branches or pull requests

1 participant