cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in hearing how one of our Community members uses Dropbox for sailing trips? Read all about it here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with upload API and character with accent

Problem with upload API and character with accent

foggy748
Explorer | Level 4

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 4

Здравко
Legendary | 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.

foggy748
Explorer | Level 4

Hey,

 

So, if I understand transform this word "Définir" to "D\u00e9finir" works?

Здравко
Legendary | 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-DB
Dropbox Staff
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    foggy748 Explorer | Level 4
What do Dropbox user levels mean?