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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to