-
Notifications
You must be signed in to change notification settings - Fork 314
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
UnicodeEncodeError: 'charmap' codec on Windows in some scenarios #387
Comments
I don't know anything about Windows. 'charmap' is not a codec I've ever heard of. I remember cmd from when I was little. I don't know what a powershell is. That said, I don't keep up with the latest minutia of python minor version release changes. I'm slowly migrating to 3.6 from 3.5, maybe this charmap thing is a 3.7 concept that I just haven't encountered yet. I'm inclined to close this as wontfix unless:
Anyone interested? |
"charmap" is not a 3.7 thing. |
https://stackoverflow.com/a/4637795/307705 suggests this may only be an issue on older pre-3.6 python versions we don't support, and there's some other good context on it on that question and related https://stackoverflow.com/questions/14630288/unicodeencodeerror-charmap-codec-cant-encode-character-maps-to-undefined. In general I think it's reasonable to expect that whatever's going on with encodings, gcalcli will do its best to show you what output it can instead of completely blowing up, at least for the basic functionality. |
Duping to #375 |
Oh hey, turns out it's easy to repro an error like this just running the tests in GH Actions on windows-latest platform (https://github.com/insanum/gcalcli/actions/runs/10533711279/job/29190148575): |
agenda
(I'll rename and keep this one as the canonical dupe for the Windows 'charmap' ones.) |
Hmm, this may be an upstream bug in the vobject dep, or possibly in our argparse setup code. There's not really any gcalcli code explicitly fiddling with encodings here, just two bits of code where we...
it's possible there's something screwy with the default encoding option on Windows, or that See docs for argparse.FileType, which point to the docs for stdlib open() for details on the encoding arg. |
Configures file arguments with errors='replace' so that if they encounter characters they can't encode/decode they'll just replace them with a replacement marker such as '?' instead of raising an exception. Fixes #387 (probably)
Configures file arguments with errors='replace' so that if they encounter characters they can't encode/decode they'll just replace them with a replacement marker such as '?' instead of raising an exception. Fixes #387 (probably)
Hey, I might have fixed this! Please reach out if you still notice severe encoding issues in the new version. |
Similar to #335, but some of the conditions & error are different.
Steps to reproduce:
Birthday Extravaganza!! 🎈🎈
at 9 p.m.gcalcli --nocolor agenda 12am 11:59pm
gcalcli agenda 9pm 11pm | findstr Birth*
gcalcli-4.0.0a5, Python 3.7.0, Microsoft Windows 10 (1803), using cmd, or powershell
The workaround mentioned in #335 (setting
PYTHONIOENCODING=utf8
) works here too, but I thought it was worth reporting anyway, as I'm running Py3.The text was updated successfully, but these errors were encountered: