c'est une question stupide n00b mais je ne comprends pas à travailler. Je crois que j'ai besoin de convertir en NSString et tirer parti de "stringWithUTF8String:" mais je ne comprends pas exactement comment l'implémenter dans ce code afin que j'obtienne la bonne sortie dans le NSLog. J'ai regardé autour mais ça ne marche toujours pas. Le plist est correct.Problème stupide avec UTF8
Ma sortie est:
2010-11-07 21:43:00.419 plist_test[2984:207] Förbered och skriv
2010-11-07 21:43:00.425 plist_test[2984:207] KLART
2010-11-07 21:43:00.425 plist_test[2984:207] LÄS IN PLIST
2010-11-07 21:43:00.427 plist_test[2984:207] array2: (
ETT,
"TV\U00c5", ========Here is the problem, should be "TVÅ"
TRE,
FYRA
)
Voici le code que je utilise.
- (void)viewDidLoad {
NSLog(@"Förbered och skriv");
NSMutableArray *array = [[NSMutableArray alloc] init];
[array addObject:@"ETT"];
[array addObject:@"TVÅ"];
[array addObject:@"TRE"];
[array addObject:@"FYRA"];
[array writeToFile:@"/Users/PeterK/Desktop/plisttest.plist" atomically: TRUE];
NSLog(@"KLART");
NSLog(@"LÄS IN PLIST");
NSMutableArray *array2 = [[NSMutableArray alloc] init];
array2 = [NSMutableArray arrayWithContentsOfFile:@"/Users/PeterK/Desktop/plisttest.plist"];
NSLog(@"array2: %@", array2); ====here is the output
[super viewDidLoad];
}
ces chaînes sont-elles correctement sérialisées sur le fichier? – rano
me semble bien: http://www.fileformat.info/info/unicode/char/c5/index.htm –