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.

Author amaury.forgeotdarc
Recipients amaury.forgeotdarc, brian.curtin, giampaolo.rodola, ocean-city
Date 2010-11-25.00:11:31
SpamBayes Score 5.551115e-17
Marked as misclassified No
Message-id <1290643893.19.0.596666408364.issue8879@psf.upfronthosting.co.za>
In-reply-to
Content
The patch uses the ANSI version, and converts the filename from unicode to bytes; this will fail for names that cannot be encoded with the "mbcs" codec.

All other functions in the posix module first try the Wide version of the win32 API, and use the ANSI version as a fallback, when the argument is a bytes string. PyUnicode_FSConverter should be avoided on Windows. See posix_mkdir() for a good example.

Here is an example that fails on a Western Windows (where ANSI=cp1252).  Note that even the file name is not encodable in mbcs, it is correctly displayed in the Explorer for example.

>>> name = "\u65e5\u672c"     # "Japan"
>>> open(name, "w").close()   # Appears correctly in the explorer
>>> import os
>>> os.link(name, name + "_1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: invalid character
History
Date User Action Args
2010-11-25 00:11:33amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, ocean-city, giampaolo.rodola, brian.curtin
2010-11-25 00:11:33amaury.forgeotdarcsetmessageid: <1290643893.19.0.596666408364.issue8879@psf.upfronthosting.co.za>
2010-11-25 00:11:31amaury.forgeotdarclinkissue8879 messages
2010-11-25 00:11:31amaury.forgeotdarccreate