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: 'charmap' codec can't decode byte 0x8f in position 4: character maps to <undefined> #8

Closed
xofeoj opened this issue Dec 1, 2017 · 5 comments

Comments

@xofeoj
Copy link

xofeoj commented Dec 1, 2017

Ran into the following issue:

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 4: character maps to

Fixed by altering line 25 in textgenrnn.py to indicate the json vocab file is utf-8 encoded:

with open(vocab_path, 'r', encoding='utf8') as json_file:

@cedspam
Copy link

cedspam commented Mar 20, 2018

add errors='ignore' parameter too, json should be encoded in satandard ascii
with open(vocab_path, 'r', encoding='utf8', errors='ignore') as json_file:

@minimaxir
Copy link
Owner

I added the ignore parameter during the refactor. Let me know if there are still issues.

@NikulGoyani369
Copy link

NikulGoyani369 commented May 27, 2019

I got the same error when I run my file
Please Help me
error is UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 819: character maps to

@cedspam
Copy link

cedspam commented May 29, 2019

adding encoding='utf8', errors='ignore' is a form of dirty fix for that when you dont know the file encoding, chardet would be the good option there

@hanumantha03
Copy link

I got this error when i opened the .pickle file normally. But when I gave open("filename.pickle", "rb") the error was gone

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

5 participants