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
Lower case file system encoding #48463
Comments
Python should lower case the file system encoding in Python/pythonrun.c. $ python2.6 -c "import sys; print sys.getfilesystemencoding()"
UTF-8
$ python3.0 -c "import sys; print(sys.getfilesystemencoding())"
UTF-8
$ locale
LANG=de_DE.UTF-8
LANGUAGE=en_US:en:de_DE:de
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL= The patch is trivial: if (codeset) {
if (!Py_FileSystemDefaultEncoding) {
char *p;
for (p=codeset; *p; p++)
*p = tolower(*p);
Py_FileSystemDefaultEncoding = codeset;
}
else
free(codeset);
} Python/codecs.c:normalizestring() does a similar job. Maybe a new method |
Converting to the lower case doesn't solve the problem: if the locale A correct patch would be to get the most common name of the charset |
The lower-casing doesn't hurt, since that's done anyway during codec |
Here is a patch to get the "most common charset name": use |
Victor's patch fixes the issue with bpo-3723. |
+1 on adding Viktor's patch. |
Me, too! The solution is elegant and works well. Barry still has to accept the patch, though. |
Fixed in r67055 |
I can't agree with that evaluation. In cases where Python would fail r67057 addresses this case in a somewhat more general manner, by falling |
Le Thursday 30 October 2008 23:14:21 Martin v. Löwis, vous avez écrit :
My patch doesn't change the way how Python get the file system encoding: it |
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: