Hallo Zusammen,
Ich schreibe mein Object in Dictionary:
[myDic setObject:tName forKey:@"tName"];
[myDic setObject:tDetail forKey:@"tDetail"];
[myDic setObject:tAdress forKey:@"tAdress"];
und dann sende ein E-mail mit JSON-Datei:
NSData *result = [NSJSONSerialization dataWithJSONObject:myDict options:NSJSONWritingPrettyPrinted error:&error];
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
[picker addAttachmentData:result mimeType:@"application/json" fileName:@"MyApp-JSON.data"];
....
In App bearbeite ich ein Attachment aus der E-Mail. Und bei deserialisieren JSON-Datei:
NSData *jData = [NSData dataWithContentsOfURL:url];
NSError* error;
NSDictionary *tDictionary = [NSJSONSerialization JSONObjectWithData:jData options:kNilOptions error:&error];
...habe ich ein Problem mit encoding (Buchstaben: ü, ö, ß).
NSString *tmpDetail = [tDictionary objectForKey:@"tDetail"];
---
NSLOG: application:openURL:sourceApplication:annotation: detail: Fu√üballspielplatz, adress: Im B√ºhl 15, 51375, Leverkusen, DE <---- soll Fußballspielplatz, ..., Im Bühl...
Was mache ich falsch? Wie soll man richtig mit encoding und JSON arbeiten?
Danke.
Ich schreibe mein Object in Dictionary:
[myDic setObject:tName forKey:@"tName"];
[myDic setObject:tDetail forKey:@"tDetail"];
[myDic setObject:tAdress forKey:@"tAdress"];
und dann sende ein E-mail mit JSON-Datei:
NSData *result = [NSJSONSerialization dataWithJSONObject:myDict options:NSJSONWritingPrettyPrinted error:&error];
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
[picker addAttachmentData:result mimeType:@"application/json" fileName:@"MyApp-JSON.data"];
....
In App bearbeite ich ein Attachment aus der E-Mail. Und bei deserialisieren JSON-Datei:
NSData *jData = [NSData dataWithContentsOfURL:url];
NSError* error;
NSDictionary *tDictionary = [NSJSONSerialization JSONObjectWithData:jData options:kNilOptions error:&error];
...habe ich ein Problem mit encoding (Buchstaben: ü, ö, ß).
NSString *tmpDetail = [tDictionary objectForKey:@"tDetail"];
---
NSLOG: application:openURL:sourceApplication:annotation: detail: Fu√üballspielplatz, adress: Im B√ºhl 15, 51375, Leverkusen, DE <---- soll Fußballspielplatz, ..., Im Bühl...
Was mache ich falsch? Wie soll man richtig mit encoding und JSON arbeiten?
Danke.
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von juris ()