We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
foggy748
2 years agoExplorer | Level 4
Problem with upload API and character with accent
Hello,
I have some problème with the upload API. When my fichier contain accent, the API return a status 401 and when I change the character without the accent it works. But in french, we need the accent. I want to know if there is a solution for this?
For the moment I use unicode() for change automatically characters that are problematic.
This is the code I use for uploading a file with the API:
return await axios({
url: url,
method: 'post',
data: metadata,
headers: {
'Authorization': 'Bearer ' + stockageInfo.token,
'Content-Type': 'application/octet-stream',
'Dropbox-API-Arg': JSON.stringify({
path: dossierId + '/' + unidecode(titre) + '.' + ext,
mode: 'overwrite'
})
}
}).then((d) => {
return d.data.id
}).catch((e) => {
// statements
console.log(e)
return null
})
4 Replies
- Здравко2 years agoLegendary | Level 20
Hi foggy748,
Unfortunately, Dropbox API doesn't support latest specifications for using unicode during json encoding. You have to use 7-bit json ASCII encoding (the previous specifications). All symbols that don't fit in 7 bits and all special symbols have to be tagged properly.
Hope this helps.
- foggy7482 years agoExplorer | Level 4
Hey,
So, if I understand transform this word "Définir" to "D\u00e9finir" works?
- Здравко2 years agoLegendary | Level 20
foggy748 wrote:...
So, if I understand transform this word "Définir" to "D\u00e9finir" works?
Correct. It should work, at least. Usually this is done automatic by most json libraries, when properly initialized.
Add: To be sure that everything is correct, dump the output of JSON.stringify. 😉 Take a look here for prototyping the call.
Good luck.
- Greg-DB2 years ago
Dropbox Community Moderator
foggy748 For reference, you can find documentation on how to encode header values here.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 2 days ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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!