We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

anildbest83's avatar
anildbest83
Explorer | Level 3
8 years ago

Accented characters in file name

I m using Dropbox V2 API  and when try to upload a file with name 'tête-à-tête' getting following error   Error in call to API function "files/upload_session/finish": HTTP header "Dropbox-API-Arg":...
  • Greg-DB's avatar
    8 years ago

    For these calls with the parameters in the header, you need to escape these characters. That is, when you use the “Dropbox-API-Arg” header, you need to make it “HTTP header safe”. This means using JSON-style “\uXXXX” escape codes for the character 0x7F and all non-ASCII characters.

     

    Some, but not all, languages/libraries do this for you. For example, in C#, using Json.NET/JsonTextWriter, that would look like:

     

    var sb = new StringBuilder();
    var textWriter = new JsonTextWriter(new StringWriter(sb));
    textWriter.StringEscapeHandling = StringEscapeHandling.EscapeNonAscii;
    
    // Write things to text writer
    textWriter.WriteStartArray();
    textWriter.WriteValue("Hello");
    ...
    
    var result = sb.toString().Replace("\x7f", "\\u007f");

     

    Or, using Json.NET/JsonConvert:

     

    var serializerSettings = new JsonSerializerSettings();
    serializerSettings.StringEscapeHandling = StringEscapeHandling.EscapeNonAscii;
    
    var result = JsonConvert.SerializeObject(..., serializerSettings);
    result = result.Replace("\x7f", "\\u007f");

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 17 minutes ago
325 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!