Re: Not so long filenames
Re: Not so long filenames
- Subject: Re: Not so long filenames
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sun, 26 Oct 2008 10:55:53 +0100
On 26 Oct 2008, at 00:30, Postmaster wrote:
On 14 Oct 2008, at 21:00, Gerriet M. Denkmann wrote:
On 14 Oct 2008, at 18:07, Jason Coco wrote:
On Oct 14, 2008, at 11:28 , Gerriet M. Denkmann wrote:
HFS+ and Finder can use filenames which use in Utf-16 up to 255
shorts.
But in the program below there seems to exist some other limit
(at least on 10.4.11 Tiger).
Where is this documented?
Or what am I doing wong?
... Filewrapper has preferred filename with 128 shorts in Utf16;
Utf8 of fileSystemRepresentation has 256 bytes
... Error: writeToFile
Filename has exited with status 2.
I'm not really sure, but one thing I noticed right away is that
256 > 255...
This is absolutely correct: 256 is greater than 255.
But the filename is 128 shorts in Utf-16 (and you might have
noticed that 128 ≤ 255 ) and can be used in Finder and HFS+ can
store it.
So again my question: why it is too long in this context and where
is this documented?
HFS+ stores files in decomposed UTF-8. Checking the system headers,
"system headers" is kind of vague: which file exactly do you have in
mind?
it can store files with a maximum file name length of 255 bytes.
How do you get 256 bytes of UTF-8 into 255 bytes?
Checking the system header hfs_format.h for HFSUniStr255 one sees
that it can store file names with a maximum length of 255 u_int16_t.
And there is no real problem of putting the 128 shorts of Utf-16 into
255 u_int16_t.
And: I strongly doubt that "HFS+ stores files in decomposed UTF-8". I
think it stores filenames in decomposed Utf-16.
Proof: use a filename which is (decomposed) less than 256 shorts in
Utf-16 but longer than 255 bytes in Utf-8 and rename a file in
Finder: it just works.
Kind regards,
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden