Re: File API: File's name property

On Thu, 29 Aug 2013 15:48:41 +0100, Anne van Kesteren <annevk@annevk.nl>  
wrote:

> As currently specified File's name property seems to be a code unit
> sequence. In zip archives the resource's path is a byte sequence. I
> don't really know what popular file systems do.

OS X has concept of "display name" and "file system representation", which  
are subtly different. Apart from localization, they swap `/` and `:`.

User can create a file named "foo/bar" (with slash appearing to the user  
as part of the filename) and Unix-ish APIs OS X will expose the name as  
"foo:bar".

Filenames are *not* opaque byte sequences on OS X. They're a special form  
of UTF-8 with forced Unicode normalization similar to Unicode NFD, e.g.  
fopen("ä",…) will create file called "a¨".

The name used to create the file may be different from name you'll read  
back in directory listing, so in OS X you can't compare names with byte or  
codepoint comparison (massive gotcha that screws almost all cross-platform  
file transfers). OSX and thus OSX-created zip files require names to be  
compared after Unicode normalization.

And getting Unicode names from zip files may be impossible. From Windows  
world they'll come in unlabelled 8-bit codepages :(

Good luck sorting this out :)

-- 
regards, Kornel

Received on Sunday, 8 September 2013 20:28:18 UTC