-
-
Notifications
You must be signed in to change notification settings - Fork 26k
MAINT force encoding when opening file to not be platform specific #27731
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
Conversation
@glemaitre Yes I can confirm that this fixes my issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Not sure that there is a (not too complex) way to test for this. You'd probably have to patch
the method used to determine the platform's default encoding in open()
I pushed a commit with a test. I am guessing the test will run on Posix platforms and be skipped on Windows. I could not find a simpler way to do it, if deemed to complex this can always be reverted 😉. |
Better to have a test. Thanks @lesteve |
Nice! I like it. And with |
Oh well the CI error comes from the fact that the locale resetting logic does not work on some platforms. This is probably due to python/cpython#78115 (comment) but this needs more investigation. |
I tweaked the test in my last commit, the debian 32bit build is now green. codecov is red because we don't have coverage for Windows since #26052 it seems (and I expect Edit: actually I double-checked and the "C" locale was available on the Windows VM I managed to create. It might be always available if I interpret this correctly
In any case, I feel the try/except in the test does not hurt ... |
Let's merge this! |
…cikit-learn#27731) Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
closes #27725
Trying to enforce the encoding while reading the CSS file such that it is not platform dependent.
@Charlie-XIAO Could you try to know if you still have the issue locally.