This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年11月05日 22:18 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| macosx.patch | vstinner, 2012年11月05日 22:18 | review | ||
| macosx-2.patch | vstinner, 2012年11月12日 13:32 | review | ||
| Messages (13) | |||
|---|---|---|---|
| msg174943 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2012年11月05日 22:18 | |
Since the changeset 45079ad1e260 (issue #4388), command line arguments are decoded from UTF-8 instead of the locale encoding. Functions of Python/fileutils.c are still using the locale encoding. It does not work: see issue #16218. On Mac OS X, in the command line "python script.py", the filename "script.py" is decoded from UTF-8 (by _Py_DecodeUTF8_surrogateescape) but then it is passed to _Py_fopen() which encodes the filename to the locale encoding (ex: ISO-8859-1 if $LANG, $LC_CTYPE and $LC_ALL environment variables are not set). The result is mojibake and Python fails to open the script. Attached patch modifies function of Python/fileutils.c to use UTF-8 to encode and decode filenames, instead of the locale encoding on Mac OS X. I don't know yet if Module/getpath.c should also decode paths from UTF-8 instead of the locale encoding on Mac OS X. We may expose _Py_decode_filename(). |
|||
| msg175441 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2012年11月12日 13:32 | |
macosx-2.patch patches _Py_wchar2char() and _Py_char2wchar() functions to use UTF-8/surrogateescape for any function using the locale encoding, not only file related functions of fileutils.h. The patch does also simplify the code, no more specific #ifdef __APPLE__ in python.c: -#ifdef __APPLE__ - argv_copy[i] = _Py_DecodeUTF8_surrogateescape(argv[i], strlen(argv[i])); -#else argv_copy[i] = _Py_char2wchar(argv[i], NULL); -#endif 2012年11月7日 Andrew Svetlov <report@bugs.python.org> > > Changes by Andrew Svetlov <andrew.svetlov@gmail.com>: > > > ---------- > nosy: +asvetlov > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue16416> > _______________________________________ > |
|||
| msg175477 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年11月12日 22:03 | |
New changeset 48fbdaf3a849 by Victor Stinner in branch 'default': Issue #16416: OS data are now always encoded/decoded to/from http://hg.python.org/cpython/rev/48fbdaf3a849 |
|||
| msg175478 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年11月12日 22:48 | |
New changeset f3e512b5ffb3 by Victor Stinner in branch 'default': Issue #16416: Fix error handling in _Py_wchar2char() _Py_char2wchar() functions http://hg.python.org/cpython/rev/f3e512b5ffb3 |
|||
| msg175479 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年11月12日 23:06 | |
New changeset 1b97cc71a05e by Victor Stinner in branch 'default': Issue #16416: Fix Misc/NEWS entry, mention Mac OS X http://hg.python.org/cpython/rev/1b97cc71a05e |
|||
| msg175480 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2012年11月12日 23:07 | |
@Serhiy: Thanks for your review, I missed it before my first commit. |
|||
| msg175481 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年11月12日 23:15 | |
Victor, are you going to backport this to 3.3? |
|||
| msg175482 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2012年11月12日 23:18 | |
> Victor, are you going to backport this to 3.3? I'm waiting for the result of the buildbots, and maybe also the fix for the issue #16455 (which has an impact on tests on undecodable bytes). |
|||
| msg176490 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2012年11月27日 20:19 | |
Victor, could you please backport to 3.3? |
|||
| msg176797 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2012年12月02日 16:08 | |
Ping. |
|||
| msg176836 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年12月03日 11:49 | |
New changeset c838c9b117f1 by Victor Stinner in branch '3.2': Issue #16416: On Mac OS X, operating system data are now always http://hg.python.org/cpython/rev/c838c9b117f1 New changeset 26c4748351cb by Victor Stinner in branch '3.3': (Merge 3.2) Issue #16416: On Mac OS X, operating system data are now always http://hg.python.org/cpython/rev/26c4748351cb |
|||
| msg176840 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年12月03日 13:13 | |
New changeset af6fd3ca6de9 by Victor Stinner in branch '3.2': Issue #16416: Fix compilation error http://hg.python.org/cpython/rev/af6fd3ca6de9 |
|||
| msg176841 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2012年12月03日 13:14 | |
The issue should now be fixed in Python 3.2, 3.3 and 3.4. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:38 | admin | set | github: 60620 |
| 2012年12月03日 13:14:59 | vstinner | set | status: open -> closed resolution: fixed messages: + msg176841 versions: + Python 3.2, Python 3.3 |
| 2012年12月03日 13:13:13 | python-dev | set | messages: + msg176840 |
| 2012年12月03日 11:49:13 | python-dev | set | messages: + msg176836 |
| 2012年12月02日 16:08:32 | pitrou | set | messages: + msg176797 |
| 2012年11月27日 20:19:54 | pitrou | set | assignee: ronaldoussoren -> vstinner messages: + msg176490 nosy: + pitrou |
| 2012年11月12日 23:18:23 | vstinner | set | messages: + msg175482 |
| 2012年11月12日 23:15:05 | serhiy.storchaka | set | messages: + msg175481 |
| 2012年11月12日 23:07:43 | vstinner | set | messages: + msg175480 |
| 2012年11月12日 23:06:18 | python-dev | set | messages: + msg175479 |
| 2012年11月12日 22:48:34 | python-dev | set | messages: + msg175478 |
| 2012年11月12日 22:03:44 | python-dev | set | nosy:
+ python-dev messages: + msg175477 |
| 2012年11月12日 13:32:54 | vstinner | set | files:
+ macosx-2.patch messages: + msg175441 |
| 2012年11月07日 11:58:43 | asvetlov | set | nosy:
+ asvetlov |
| 2012年11月05日 22:20:18 | vstinner | set | nosy:
+ serhiy.storchaka |
| 2012年11月05日 22:18:23 | vstinner | create | |