Hi, I have noticed that special characters are destoryed when they are copied one by one from one string into another. Listed below is some demo code (demo.h, Demo.m) which yields the console log also listed below (Demo.log).
It states that the String containig no special characters is copied properly while the other is not. Any idea why? Thanks in advance Horst :::::::::::::::::::::::::::::::::::: Demo.log :::::::::::::::::::::::::::::::::::: 2011-04-05 17:47:24.280 Demo[8890:207] Wurst Wurst 1 2011-04-05 17:47:24.281 Demo[8890:207] Käse K‰se 0 :::::::::::::::::::::::::::::::::::: /Demo.log :::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::: Demo.h :::::::::::::::::::::::::::::::::::: @interface Demo : NSObject +(NSString*)copyUnicharByUnicharString:(NSString*)src; +(void)demo; @end :::::::::::::::::::::::::::::::::::: /Demo.h :::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::: Demo.m :::::::::::::::::::::::::::::::::::: #import "Demo.h" @implementation Demo +(NSString*)copyUnicharByUnicharString:(NSString*)src{ NSMutableString* dst = [NSMutableString string]; NSUInteger length = [src length]; for(NSUInteger index = 0; index < length; ++index){ unichar chr = [src characterAtIndex:index]; [dst appendFormat:@"%c", chr]; } return dst; } +(void)demo{ NSString* sausageString = @"Wurst"; // Wurst is the German word for sausage NSString* cheeseString = @"Käse" ; // Käse is the German word for cheese NSString* sausageStringCopy = [self copyUnicharByUnicharString:sausageString]; NSString* cheeseStringCopy = [self copyUnicharByUnicharString:cheeseString ]; BOOL sausageStringIsEqualToSausageStringCopy = [sausageString isEqualToString:sausageStringCopy]; BOOL cheeseStringIsEqualToCheeseStringCopy = [cheeseString isEqualToString:cheeseStringCopy ]; NSLog(@"%@ %@ %d", sausageString, sausageStringCopy, sausageStringIsEqualToSausageStringCopy); NSLog(@"%@ %@ %d", cheeseString , cheeseStringCopy , cheeseStringIsEqualToCheeseStringCopy ); } @end :::::::::::::::::::::::::::::::::::: Demo.m :::::::::::::::::::::::::::::::::::: -- Horst Jäger h.jae...@medienkonzepte.de Medienkonzepte http://www.medienkonzepte.de/ Schaafenstr. 25, 50676 Köln, Germany Tel +49 221 93187017 / Fax +49 221 93187029 _______________________________________________ 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 arch...@mail-archive.com