Hi all.
International Character set support is killing me.
I'm using UIAlertview to grab a Name (any language)
and the PHP is getting this the
and if I paste this into a Sequal Pro Query and run it. It works fine.
BUT in the MySQL I get back: õneDây
I've pasted (non-english) text into the MySQL and it does return the correct characters. not sure where the string is getting messed up or something.
I have set:
using this to send:
International Character set support is killing me.
I'm using UIAlertview to grab a Name (any language)
and the PHP is getting this the
Code:
echo "$sql";
Gives me:
INSERT INTO HighScore_elements_global(userName, userID, score, country) VALUES ('õneDây', '00:01:06', '66', 'United States')'
BUT in the MySQL I get back: õneDây
I've pasted (non-english) text into the MySQL and it does return the correct characters. not sure where the string is getting messed up or something.
I have set:
Code:
header('content-type: application/json; charset=utf-8');
mb_internal_encoding("UTF-8");
$link = mysqli_connect("localhost", "myTable", "password", "myHighScorerGlobal");
mysqli_set_charset($link, "utf8");
using this to send:
Code:
NSMutableArray* sendAllJSONDICT = [[NSMutableArray alloc]init ];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
userScore.name,@"userName",
userScore.gameTime,@"userID",
[NSNumber numberWithInt:userScore.gameTimeSeconds],@"score",
userScore.country ,@"country",
nil];
[sendAllJSONDICT addObject:params];
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:sendAllJSONDICT options:NSJSONWritingPrettyPrinted error:nil];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding: NSUTF8StringEncoding];
NSDictionary *paramass =[NSDictionary dictionaryWithObject:jsonString forKey:@"jsonarr"];
uploadError = YES; // Set Error Flag
[httpClient postPath:@"/recieveScore.php" parameters:paramass success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSString *responseStr = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
NSLog(@"Request Successful, response '%@'", responseStr);
sharedHSData.queuedItems=NO;
uploadError = NO;
[[NSNotificationCenter defaultCenter] postNotificationName:@"JSONCOMPLETED"
object:nil];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
// if we fail add the score to a send Que and load the old //
NSLog(@"[HTTPClient Error]: %@", error.localizedDescription);
// Some sort of Flag that says Update did not happen and Should be added to Que in a singleton.//
// AND Update the Global High Score So it looks like the Score has already been sent //
// it's about responsiveness !!! //
if (highScoreIdent==0) {
sharedHSData.queuedItems=YES;
[sharedHSData.myQuedHighScores addObject:userScore];
}
}];
Last edited: