comparison Modules/python.c @ 65270:3335edce48a3

Issue #9992: On Mac OS X, decode command line arguments from utf-8 instead of the locale encoding.
author Victor Stinner <victor.stinner@haypocalc.com>
date Wed, 13 Oct 2010 22:15:06 +0000
parents cab14be0ada1
children e9ea09787a35
comparison
equal deleted inserted replaced
65267:61c35472a4f8 65270:3335edce48a3
39 return 1; 39 return 1;
40 } 40 }
41 oldloc = strdup(setlocale(LC_ALL, NULL)); 41 oldloc = strdup(setlocale(LC_ALL, NULL));
42 setlocale(LC_ALL, ""); 42 setlocale(LC_ALL, "");
43 for (i = 0; i < argc; i++) { 43 for (i = 0; i < argc; i++) {
44 argv_copy2[i] = argv_copy[i] = _Py_char2wchar(argv[i]); 44 #ifdef __APPLE__
45 /* Use utf-8 on Mac OS X */
46 PyObject *unicode = PyUnicode_FromString(argv[i]);
47 argv_copy[i] = PyUnicode_AsWideCharString(unicode, NULL);
48 Py_DECREF(unicode);
49 #else
50 argv_copy[i] = _Py_char2wchar(argv[i]);
51 #endif
52 argv_copy2[i] = argv_copy[i];
45 if (!argv_copy[i]) 53 if (!argv_copy[i])
46 return 1; 54 return 1;
47 } 55 }
48 setlocale(LC_ALL, oldloc); 56 setlocale(LC_ALL, oldloc);
49 free(oldloc); 57 free(oldloc);