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
Inconsistency between venv and site #69372
Comments
venv writes pyvenv.cfg with utf-8 encoding, but site reads it with locale encoding. |
Example: $ LC_ALL=ru_RU.cp1251 ./python -m venv ../vpy×
$ LC_ALL=ru_RU.cp1251 ./python -m venv ../vpyØ
Error: 'charmap' codec can't encode character '\udc98' in position 617: character maps to <undefined> The first command is successful, the latter command is failed. 'Ø'.encode('utf-8') == b'\xc3\x98', and 0x98 is invalid code in CP1251. |
Seems like the right fix would be to change site.py to read it using UTF-8. |
I suspect that this can break backward compatibility. |
But since venv writes it out as UTF-8 already, it should be read in UTF-8, and if it isn't, isn't that the cause of the error which led to this bug we're talking about? If we now write it with locale encoding, anything that previously assumed we were writing it in UTF-8 might break. While I'm not aware of any specific software which reads pyvenv.cfg other than the site.py code, there could well be third party code which does so. |
I thought that pyvenv.cfg was used by venv's predecessor virtualenv. Now I see that I was wrong and your idea is right. |
New changeset d927c6cae05f by Vinay Sajip in branch '3.4': New changeset eaf9220bdee3 by Vinay Sajip in branch '3.5': New changeset 69dd42cef190 by Vinay Sajip in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: