[Python-ideas] Fix default encodings on Windows
Random832
random832 at fastmail.com
Thu Aug 18 11:45:55 EDT 2016
On Thu, Aug 18, 2016, at 11:29, Chris Angelico wrote:
> >>>> glob.glob('test*')
> > ['test\uab00.txt']
> >>>> glob.glob(b'test*')
> > [b'test?.txt']
> >
> > The Unicode character in the second call to glob is missing information.
>
> Apologies if this is just noise, but I'm a little confused by this.
> The second call to glob doesn't have any Unicode characters at all,
> the way I see it - it's all bytes. Am I completely misunderstanding
> this?
The unicode character is in the actual name of the actual file being
matched. That the byte string returned by glob fails to represent that
character in any encoding is the problem. Glob results don't exist in a
vacuum, they're supposed to represent, and be usable to access, files
that actually exist on the real filesystem.
More information about the Python-ideas
mailing list