0
サーバーにリクエストに+文字の強制電話番号などの詳細を掲示して問題が発生しました。サーバー側に+文字が表示されません。URLリクエストをWebサーバーに送信する際に+文字を処理する方法
curl = [curl stringByAppendingString:@"name="];
curl = [curl stringByAppendingString:profileObj.name];
curl = [curl stringByAppendingString:@"&email="];
curl = [curl stringByAppendingString:profileObj.email];
curl = [curl stringByAppendingString:@"&password="];
curl = [curl stringByAppendingString:profileObj.password];
curl = [curl stringByAppendingString:@"&phoneno="];
curl = [curl stringByAppendingString:profileObj.phoneno]; // here my data is +919999999999
curl = [curl stringByAppendingString:@"&address="];
curl = [curl stringByAppendingString:profileObj.address];
curl = [curl stringByReplacingOccurrencesOfString:@"\n" withString:@""];
NSString *escapedUrlString = [curl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *finalURL = [NSURL URLWithString:escapedUrlString];
[self updateStatus];
if (internetConnectionStatus == NotReachable)
{
UIAlertView *reachbleAlert = [[UIAlertView alloc] initWithTitle:@"Network Error"
message:@"No Network Available. \n This Application requires network connectivity. "
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles: nil];
[reachbleAlert show];
[reachbleAlert release];
return;
}
else
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:finalURL
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval:10];
[theRequest setHTTPMethod:@"POST"];
[[[NSURLConnection alloc] initWithRequest:theRequest delegate:self] autorelease];
[pool release];
}
私はラインの下に使用されます。サーバーに要求する前に
NSString *escapedUrlString = [curl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
。ですから、+文字を扱うための解決策を教えてください。