You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
anildbest83
8 years agoExplorer | Level 3
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":...
- 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");
Greg-DB
Dropbox Staff
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");
anildbest83
8 years agoExplorer | Level 3
Thanks Greg-DB , it is working absolutely fine.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days agoIf 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!