[GH-ISSUE #173] 'charmap' codec can't encode character '\u021b' in position 24696: character maps to <undefined> #602

Closed
opened 2026-03-13 22:07:22 +03:00 by kerem · 3 comments
Owner

Originally created by @GitNees on GitHub (Nov 2, 2020).
Original GitHub issue: https://github.com/alexal1/Insomniac/issues/173

https://www.fileformat.info/info/unicode/char/021b/index.htm

Crashed with this character in text of a users post.

Wrong encoding used? cp1252?

Originally created by @GitNees on GitHub (Nov 2, 2020). Original GitHub issue: https://github.com/alexal1/Insomniac/issues/173 https://www.fileformat.info/info/unicode/char/021b/index.htm Crashed with this character in text of a users post. Wrong encoding used? cp1252?
kerem closed this issue 2026-03-13 22:07:27 +03:00
Author
Owner

@GitNees commented on GitHub (Nov 2, 2020):

How can we set UTF-8 as encoding?

It seems cp1252 is VERY limited, when you encounter foreign languages. I think UTF-8 is a better option.

<!-- gh-comment-id:720763120 --> @GitNees commented on GitHub (Nov 2, 2020): How can we set UTF-8 as encoding? It seems cp1252 is VERY limited, when you encounter foreign languages. I think UTF-8 is a better option.
Author
Owner

@GitNees commented on GitHub (Nov 2, 2020):

Ok, it seems on windows, Python uses cp1252 by default, this causes the issues.

Not sure how in code it can be set, but there seem to be 2 option to activate UTF-8

To enable UTF-8 mode:

Set the the environment variable PYTHONUTF8=1, or
Use -Xutf8 command line option.

This would mean you do python -Xutf8 start.py --your commands... still need to test it.

But would be better if its done by the program. I think instapy used to have that issue also, not sure how they fixed it back then.

<!-- gh-comment-id:720770459 --> @GitNees commented on GitHub (Nov 2, 2020): Ok, it seems on windows, Python uses cp1252 by default, this causes the issues. Not sure how in code it can be set, but there seem to be 2 option to activate UTF-8 To enable UTF-8 mode: Set the the environment variable PYTHONUTF8=1, or Use -Xutf8 command line option. This would mean you do python -Xutf8 start.py --your commands... still need to test it. But would be better if its done by the program. I think instapy used to have that issue also, not sure how they fixed it back then.
Author
Owner

@GitNees commented on GitHub (Nov 4, 2020):

@alexal1 this command resolved the issue. Not sure if it can be forced in the app itself or only way is the command.

You might put that in the readme for windows users, as this will resolve several crashes!

Also confirmed by another user this fix stopped the crashing.

<!-- gh-comment-id:721958106 --> @GitNees commented on GitHub (Nov 4, 2020): @alexal1 this command resolved the issue. Not sure if it can be forced in the app itself or only way is the command. You might put that in the readme for windows users, as this will resolve several crashes! Also confirmed by another user this fix stopped the crashing.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Insomniac#602
No description provided.