[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-26 Thread Yuval Greenfield
Yuval Greenfield ubershme...@gmail.com added the comment: I use python a lot with Hebrew and many websites have internationalization which may involve unicode paths. I agree that saying unicode paths are rare is inaccurate. If the current situation isn't fixed though - you just can't use the

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-26 Thread Yuval Greenfield
Yuval Greenfield ubershme...@gmail.com added the comment: Another option btw is to use utf-16, which will work but it's a bit ugly as well: os.listdir(os.path.abspath(u'.').encode('utf-16')) [] os.path.abspath(u'.') u'C:\\Users\\alon\\Desktop\\\u05e9\u05dc\u05d5\u05dd'

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-26 Thread Atsuo Ishimoto
Atsuo Ishimoto ishim...@gembook.org added the comment: On Wed, Oct 26, 2011 at 3:36 PM, Yuval Greenfield rep...@bugs.python.org wrote: If the current situation isn't fixed though - you just can't use the resulting path for almost anything. Do you have a use case Ishimoto? I don't have use

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-26 Thread Yuval Greenfield
Yuval Greenfield ubershme...@gmail.com added the comment: It won't break existing code. Ignoring this problem here only moves the exception to whenever the data returned is first used. Any code this fix breaks is already broken. -- ___ Python

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-26 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Yuval Greenfield ubershme...@gmail.com added the comment: Another option btw is to use utf-16 UTF-8, UTF-16 or any encoding different than the ANSI code page are not an option. The Windows bytes API expect filenames encoded to

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-26 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: Yuval, you are assuming that *no one* who uses the os byte APIs on Windows is either checking for '?' in returned paths or catching later exceptions. With Google code search, I did find one instance where someone tests paths for '?' after

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-26 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 2cad20e2e588 by Victor Stinner in branch 'default': Close #13247: Add cp65001 codec, the Windows UTF-8 (CP_UTF8) http://hg.python.org/cpython/rev/2cad20e2e588 -- nosy: +python-dev resolution: - fixed stage:

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-26 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Oops, I specified the wrong issue number in my changeset 2cad20e2e588, it's the issue #13216. -- resolution: fixed - status: closed - open ___ Python tracker rep...@bugs.python.org

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-25 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: os.getcwdb() (GetCurrentDirectoryA) and os.listdir(bytes) (FindNextFileA co) encode filenames using WideCharToMultiByte() in default mode (flags=0): unencodable characters are replaced by question marks. Such filenames cannot be

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-25 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: os_mbcs.patch adds _Py_EncodeCodePage() to encode directly wchar_t* filenames without having to create a temporary Unicode object. The patch removes HAVE_MBCS because the MBCS is now always needed by the posixmodule.c. Anyway, I

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-25 Thread Atsuo Ishimoto
Atsuo Ishimoto ishim...@gembook.org added the comment: -1 from me. - I hate to see Unicode exceptions here. It would be an another source of mysterious Unicode exception. Programmers and users would be confused by error message. If you make such characters error, Python should raise an

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-25 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Le 26/10/2011 01:32, Atsuo Ishimoto a écrit : - I don't think filenames cannot be decoded in ANSI code page are rare enough to be ignored. The issue is able being able to be noticied of encoding errors. Currently, unencodable

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-25 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: The doc says All functions accepting path or file names accept both bytes and string objects, and result in an object of the same type, if a path or file name is returned. It does that now (the encoding assumed or produced for bytes is not

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-25 Thread Atsuo Ishimoto
Atsuo Ishimoto ishim...@gembook.org added the comment: On Wed, Oct 26, 2011 at 9:12 AM, STINNER Victor rep...@bugs.python.org wrote: STINNER Victor victor.stin...@haypocalc.com added the comment: Le 26/10/2011 01:32, Atsuo Ishimoto a écrit : - I don't think filenames cannot be decoded in

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-24 Thread Yuval Greenfield
Yuval Greenfield ubershme...@gmail.com added the comment: An example error with abspath and bytes input: os.path.abspath('.') 'C:\\Users\\yuv\\Desktop\\YuvDesktop\\\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5' os.path.abspath(b'.') b'C:\\Users\\yuv\\Desktop\\YuvDesktop\\??'

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-23 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: abspath() is implemented using nt._getfullpathname() which calls GetFullPathNameA(). The returned path with question marks is completely useless. Can you open the file using such filename? If no, I agree that the result is

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-22 Thread Yuval Greenfield
New submission from Yuval Greenfield ubershme...@gmail.com: For Python 2: Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 os.path.abspath('.') 'C:\\Users\\yuv\\Desktop\\YuvDesktop\\??' os.path.abspath(u'.')

[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-22 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +haypo versions: -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13247 ___ ___