W3C home > Mailing lists > Public > www-archive@w3.org > September 2013

Re: File API: File's name property

From: Kornel Lesiński <kornel@geekhood.net>
Date: Sun, 08 Sep 2013 21:27:45 +0100
To: annevk@annevk.nl
Cc: "www-archive@w3.org" <www-archive@w3.org>
Message-ID: <op.w230gjamte2ec8@aimac.local>
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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:44:23 UTC