L
L
llCorvinuSll2013-11-22 13:38:09
API
llCorvinuSll, 2013-11-22 13:38:09

Using the webnames.ru API (RegTimeSRS) in C#

Hello, I'm trying to call the above via HttpWebRequest. Everything is fine with Latin, but there is a problem with Cyrillic fields:

person_r: "Person (in russian)" field must contain latin or cyrillic letters, digits, spaces or . , - ( ) " & # / + '.
etc. while the fields are taken from their docks ("Vasily Nikolaevich Pupkin")
Actually the call method:
foreach (string key in param.Keys) // param - NameValueCollection со сформированными параметрами 
{
   parameters.AppendFormat("{0}={1}&",
   HttpUtility.UrlEncode(key),
   HttpUtility.UrlEncode(param[key])
   );
}

var encoded = parameters.ToString().TrimEnd('&');

var request = (HttpWebRequest)HttpWebRequest.Create(ServiceURL);
request.ProtocolVersion = HttpVersion.Version10;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded; charset=utf-8";

using (var writer = new StreamWriter(request.GetRequestStream()))
{
   writer.Write(encoded);
}

I can't understand in what format they need the Cyrillic alphabet, because everything is done according to the standard.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
llCorvinuSll, 2013-11-22
@llCorvinuSll

These gentlemen seem to have a very hard time writing docs. The description says that you need to load in UTF-8, but you need to ... windows-1251

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question