Unicode Chars in Windows Path
Peter Otten
__peter__ at web.de
Thu Apr 3 09:09:53 EDT 2014
Marko Rauhamaa wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>> Small clarification: The Windows *API* accepts both types of slash
>> (you can open a file using forward slashes, for instance), but not all
>> Windows *applications* are aware of this (generally only
>> cross-platform ones take notice of this), and most Windows *users*
>> prefer backslashes. So when you come to display a Windows path, you
>> may want to convert to backslashes. But that's for display.
>
> Didn't know that. More importantly, I had thought forward slashes were
> valid file basename characters, but Windows is surprisingly strict about
> that:
>
> < > : " / \ | ? * NUL
>
> are not allowed in basenames. Unix/linux disallows only:
>
> / NUL
>
> In fact, proper dealing with punctuation in pathnames is one of the main
> reasons to migrate to Python from bash. Even if it is often possible to
> write bash scripts that handle arbitrary pathnames correctly, few script
> writers are pedantic enough to do it properly. For example, newlines in
> filenames are bound to confuse 99.9% of bash scripts.
That doesn't bother me much as 99.8% of all bash scripts are already
confused by ordinary space chars ;)
More information about the Python-list
mailing list