0

I'm trying to create folder using new API.

If folder name contains cyrillic letters, I receive HTTP 400 Bad Request. However it works fine with latin letters.

Is it known issue?

z0rch
  • 55
  • 9

2 Answers2

3

I found correct answer here: Detecting the character encoding of an HTTP POST request

the default encoding of a HTTP POST is ISO-8859-1.

The only thing I need is to manually set encoding of the request. By the way, here is working code:

public static Task<string> Post(string url, string data, string authToken) {
    var client = new WebClient { Encoding = Encoding.UTF8 };
    client.Headers.Add("Content-Type:application/x-www-form-urlencoded");
    client.Headers.Add(AuthHeader(authToken));
    return client.UploadStringTaskAsync(new Uri(url), "POST", data);
}
Community
  • 1
  • 1
z0rch
  • 55
  • 9
-1

Usually, complications involving international characters in Box API calls just need minor adjustments to the encoding of the requests. I'm guessing you'll just have to encode the target folder name with a urlencode.

If that doesn't do the trick, we may be able to help more if you send a sample request or code snippet. If you do, keep the api key and auth token to yourself.

  • 3
    That's not correct solution. If I encode folder name with UrlEncode, created folder will be named %D1%80... However I found and posted the correct answer. – z0rch Jul 08 '12 at 18:31