Note that there are some explanatory texts on larger screens.

plurals
  1. POIncorrect NSStringEncoding value 0x0000 detected (using ASIHTTPRequest)
    primarykey
    data
    text
    <p>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:</p> <p><em>" Incorrect NSStringEncoding value 0x0000 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future "</em></p> <p>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. </p> <p>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. </p> <p><em>Edit</em> When the error occurs no response from server is recieved so the user is stuck at register/login.</p> <p><strong>urlEncodeValue:</strong></p> <pre><code>- (NSString *)urlEncodeValue:(NSString *)str { NSString *result = (NSString *) CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)str, NULL, CFSTR(":/?#[]@!$&amp;’()*+,;="), kCFStringEncodingUTF8); return [result autorelease]; } </code></pre> <p><strong>ASIHTTPRequest code snippet:</strong></p> <pre><code> 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 } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload