Problems with japanese characters
Problems with japanese characters
- Subject: Problems with japanese characters
- From: Development <email@hidden>
- Date: Sun, 26 Jul 2009 14:02:45 -0700
Ok. I've googled it and it would seem that 日本 is how you represent
japan in japanese. The app I need requires this data. I have to send
it to a server and store it and am doing so in UTF8
I send the data with UTF8 encoding and this is what it sends:
Êó•Êú¨ which makes no sense. this comes from NSLog(@"%s",
[[location objectForKey:@"Country]UTF8String]);
Anyway the server gets the data and I urlencode it since that is the
only way it will store in the database and not be completely
destroyed. so this is in the database: "æ—" I assumed this was
accurate. I was wrong. Back in the application when it gets the data
back this is what I get: US. Now I am lost. How is this happening? Why
am I getting not only the wrong country but the wrong language?
By the way the Database and the app are both using UTF8. The script
does rawurlencode otherwise the information is mangled in the DB.
NSString *myRequestString =[NSString stringWithFormat:@"UDID=%@&City=
%@&State=%@&Country=%@&placeholder=1",
[location objectForKey:@"UDID"],
[location objectForKey:@"City"],
[location objectForKey:@"State"],
[location objectForKey:@"Country"]];
NSLog(@": %s",[[location objectForKey:@"Country"]UTF8String] );
NSData *myRequestData = [ NSData dataWithBytes: [ myRequestString
UTF8String ] length: [ myRequestString length ] ];
NSMutableURLRequest *request = [ [ NSMutableURLRequest alloc ]
initWithURL:url];
[ request setHTTPMethod: @"POST" ];
[ request setHTTPBody: myRequestData ];
[request setValue:@"application/x-www-form-urlencoded"
forHTTPHeaderField:@"content-type"];
NSURLResponse* urlResponse;
NSError* error;
NSData* result = [NSURLConnection sendSynchronousRequest:request
returningResponse:&urlResponse error:&error];
NSString * responseString = [[NSString alloc]initWithData:result
encoding:NSUTF8StringEncoding];
NSDictionary * responseDict= [responseString
propertyListFromStringsFileFormat];
NSLog(@"%@",responseDict);_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden