• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Not so long filenames
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Not so long filenames


  • Subject: Re: Not so long filenames
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Wed, 15 Oct 2008 13:12:12 +0200


On 14 Oct 2008, at 23:43, Sean McBride wrote:

On 10/14/08 5:28 PM, Gerriet M. Denkmann said:

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?


#import <Cocoa/Cocoa.h>

int main (int argc, const char * argv[])
{
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

  NSData *data = [ @"Some Data" dataUsingEncoding:
NSUTF8StringEncoding ];
  NSFileWrapper *aWrapper = [ [ NSFileWrapper alloc ]
initRegularFileWithContents: data ];
	NSString *f2 = [ NSString stringWithUTF8String: 	//	64 * DESERET
CAPITAL LETTER LONG I
											"???????????????
??????????????????
??????????????????
?????????????"// 64
					];

Are you trying to create a constant NSString with UTF8 characters in your source? Is that what all the '?' chars are?
The '?' were (before being mangled by some silly mail software) DESERET CAPITAL LETTER LONG I.

You can only do that in 10.5.

Well, I not only tried but did this successfully in 10.4. The documentation says about stringWithUTF8String: "Available in Mac OS X v10.0 and later."
What is new in 10.5 is: NSString *s = @"string with more than just plain Ascii";


But this is not my question. It is about how to measure the acceptable length of a filename.

A filename must not be longer than 255. Ok.
But what is the length of a filename?
The number of characters obviously. But what is a character?

A graphem? Then my string has a length of 64.

The number of shorts in Utf-16 (this is what -[NSString length] returns)? This is the metric used by Finder and HFS+ (see HFSUniStr255 in /usr/include/hfs/hfs_format.h). Using this metric my string has a length of 128.

Or the number of bytes in Utf-8 ( strlen( [path fileSystemRepresentation] ) )? This seems to be the case in my program. With this metric my string a a length of 256.

So again: how and where is the acceptable length of a filename defined?


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


References: 
 >Not so long filenames (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Not so long filenames (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Re: how to complete c/s app
  • Next by Date: Re: Not so long filenames
  • Previous by thread: Re: Not so long filenames
  • Next by thread: Re: Cocoa-dev Digest, Vol 5, Issue 1774
  • Index(es):
    • Date
    • Thread