mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #9992: On Mac OS X, decode command line arguments from utf-8 instead of
the locale encoding.
This commit is contained in:
parent
eb1410fc40
commit
90bbaa57f9
2 changed files with 12 additions and 1 deletions
|
@ -10,6 +10,9 @@ What's New in Python 3.2 Beta 1?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #9992: On Mac OS X, decode command line arguments from utf-8 instead of
|
||||||
|
the locale encoding.
|
||||||
|
|
||||||
- Issue #9992: Remove PYTHONFSENCODING environment variable.
|
- Issue #9992: Remove PYTHONFSENCODING environment variable.
|
||||||
|
|
||||||
Library
|
Library
|
||||||
|
|
|
@ -41,7 +41,15 @@ main(int argc, char **argv)
|
||||||
oldloc = strdup(setlocale(LC_ALL, NULL));
|
oldloc = strdup(setlocale(LC_ALL, NULL));
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
argv_copy2[i] = argv_copy[i] = _Py_char2wchar(argv[i]);
|
#ifdef __APPLE__
|
||||||
|
/* Use utf-8 on Mac OS X */
|
||||||
|
PyObject *unicode = PyUnicode_FromString(argv[i]);
|
||||||
|
argv_copy[i] = PyUnicode_AsWideCharString(unicode, NULL);
|
||||||
|
Py_DECREF(unicode);
|
||||||
|
#else
|
||||||
|
argv_copy[i] = _Py_char2wchar(argv[i]);
|
||||||
|
#endif
|
||||||
|
argv_copy2[i] = argv_copy[i];
|
||||||
if (!argv_copy[i])
|
if (!argv_copy[i])
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue