osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why exception from os.path.exists()?


On Fri, Jun 8, 2018 at 11:35 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
>
> (referring to both the NUL bytes in UTF-16 encoded NTFS file names, and
> the lack of NUL bytes in common Linux file names).

NTFS filenames are stored as wchar_t strings, for which NUL is
L"\x00\x00". Individual null bytes are irrelevant to this problem,
unless we're using an encoding such as an ASCII superset that stores
the character NUL as "\x00".