I'm using ASIHTTPRequst in my application and im having some problems, but only on certain devices. In some cases i get the following error:
" Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future "
I got limited options for testing this out, because it works on all my internal test devices, but the problem still occurs on one or more of my clients test phones. It may also be a case when the phone is connected to the cellular network, as it seems to be working on wifi.
Does anyone know what might cause the problem? I see there are similar type of questions but my code looks like its correct both from the other questions answers and the ASIHTTPRequest site.
Edit When the error occurs no response from server is recieved so the user is stuck at register/login.
urlEncodeValue:
- (NSString *)urlEncodeValue:(NSString *)str
{
NSString *result = (NSString *) CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)str, NULL, CFSTR(":/?#[]@!$&’()*+,;="), kCFStringEncodingUTF8);
return [result autorelease];
}
ASIHTTPRequest code snippet:
NSString *encodedUrlAdress = [NSString stringWithFormat:@"%@user/register/%@/%@/%@/%d/%@/%@/%@/%@",
kUserServerAddress,
[self urlEncodeValue:_firstName],
[self urlEncodeValue:_lastName],
[self urlEncodeValue:_phoneNumber],
_sex,
[self urlEncodeValue:_birthDate],
[self urlEncodeValue:_address],
[self urlEncodeValue:_postalNumber]];
NSLog(@"encodedUrlAdress: %@", encodedUrlAdress);
NSURL *url = [NSURL URLWithString:encodedUrlAdress];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request startSynchronous];
NSError *error = [request error];
if (!error) {
// do stuff
}