* Posts by Rosyna

1 publicly visible post • joined 6 Apr 2007

Don't forget the ‘C’ in Objective-C

Rosyna

Further flawed example

Do you understand why stringWithCString: is deprecated? It's because it assumes the system encoding. In other words, it's the *same* as stringWithCString:encoding:[NSString defaultCStringEncoding]. You should never, ever, ever, ever call [NSString defaultCStringEncoding] or CFStringGetSystemEncoding(). It's equivalent to using no encoding. If the user's default language is korean, it'll return MacKorean, if it is japanese, it'll return MacJapanese, if it is English, it'll return MacRoman.

SPECIFY AN ENCODING! Use NSUTF8StringEncoding if you're creating new strings. Just never, ever use the system encoding.