Hello. The problem of the following nature. I send a request to the server using the GET method

phoneV = _textVPhone.text; passwordV = _textVPas.text; NSString *urlConnect = [NSString stringWithFormat: @"http://mangashow.ru/test/fri/user_login_gai.php?kod=19&phone=%@&password=%@", phoneV, passwordV]; // Создать запрос. NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString: urlConnect]]; NSLog(@"адрес подключения: %@", request); // Создать соединение и послать запрос NSURLConnection * conn = [[NSURLConnection alloc] initWithRequest:request delegate:self]; 

No problems arise until I insert the Cyrillic alphabet in the request. But as soon as RussianV words appear in the passwordV variable. (The same variable is then inserted into the url, the values ​​in the variable itself are inserted from the Text Viled,) then I get null in the request and accordingly the request goes nowhere. Here are the log data:

1) when everything is fine

 <NSURLRequest: 0x7f7fed150b90> { URL: http://mangashow.ru/test/fri/user_login_gai.php?kod=19&phone=80890809&password=admin } 

2) And when in the Cyrillic query

 2016-02-21 15:12:30.560 gai.net[10440:279246] адрес подключения: <NSURLRequest: 0x7f7fea52be50> { URL: (null) } 

    1 answer 1

    Okay, straining the head processor and the query string from Yandex, the problem was solved. The fact is that I completely forgot about the encoding of the sent request, and that worked fine only with the Latin alphabet. In order to send Cyrillic in the request you need to add:

     urlConnect = [urlConnect stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 

    Can someone come in handy.