<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: International characters in filenames in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/239497#M13319</link>
    <description>&lt;P&gt;Actually i use Jackson format json as follow:&lt;/P&gt;
&lt;PRE&gt;        String path = "/blackdog/中文PRD.docx";
        path = StringEscapeUtils.escapeJava(path);
        path_req.setPath(path);
        String header_json = JsonUtils.writeValue(path_req);
        LoggerUtils.logInfo(this.getClass(), header_json);&lt;/PRE&gt;
&lt;P&gt;In java double / standards /,so following code&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;"Dropbox-API-Arg: {"path":"/blackdog/\u4e2d\u6587prd.docx"}"&lt;/PRE&gt;
&lt;P&gt;is correct in Java.&lt;/P&gt;</description>
    <pubDate>Fri, 01 Sep 2017 03:07:01 GMT</pubDate>
    <dc:creator>jianwen</dc:creator>
    <dc:date>2017-09-01T03:07:01Z</dc:date>
    <item>
      <title>International characters in filenames</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/175750#M6947</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am migrating to V2 of REST API and&amp;nbsp;I am having problems with endpoints that&amp;nbsp;require passing arguments using&amp;nbsp;"Dropbox-API-Arg" header (for example,&amp;nbsp;&lt;A href="https://content.dropboxapi.com/2/files/download" rel="nofollow noreferrer" target="_blank"&gt;https://content.dropboxapi.com/2/files/download&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;The problem is I&amp;nbsp;am not being able to&amp;nbsp;pass filenames containing international characters.&lt;/P&gt;
&lt;P&gt;For example, I have a file "моя запись.txt" saved in my folder, with path&amp;nbsp;"/моя запись.txt"&lt;/P&gt;
&lt;P&gt;When I try to simply pass this string in the header, I get an&amp;nbsp;error from ajax:&lt;/P&gt;
&lt;P&gt;SyntaxError: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': '{"path":"/моя запись.txt"}' is not a valid HTTP header field value.&lt;/P&gt;
&lt;P&gt;In V1 of API I simply encoded every path using&amp;nbsp;encodeURIComponent function. In that case the path&amp;nbsp;"/моя запись.txt" would become&amp;nbsp;"%2F%D0%BC%D0%BE%D1%8F%20%D0%B7%D0%B0%D0%BF%D0%B8%D1%81%D1%8C.txt" and that worked for V1.&lt;/P&gt;
&lt;P&gt;However, when I try the same with the V2, I get the following error from API:&lt;/P&gt;
&lt;P&gt;Error in call to API function "files/download": HTTP header "Dropbox-API-Arg": path: '%2F%D0%BC%D0%BE%D1%8F%20%D0%B7%D0%B0%D0%BF%D0%B8%D1%81%D1%8C.txt' did not match pattern...&lt;/P&gt;
&lt;P&gt;I tried to bypass this validation by keeping the slash and encoding only the file name itself. In this case the filepath becomes&amp;nbsp;"/%D0%BC%D0%BE%D1%8F%20%D0%B7%D0%B0%D0%BF%D0%B8%D1%81%D1%8C.txt". This seems to be recognized as a valid path, but I get a new error:&lt;/P&gt;
&lt;P&gt;"path/not_found/"&lt;/P&gt;
&lt;P&gt;How do I correctly pass that path&amp;nbsp;"/моя запись.txt" to the API endpoint?&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Artem&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:31:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/175750#M6947</guid>
      <dc:creator>Artem K.</dc:creator>
      <dc:date>2019-05-29T09:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: International characters in filenames</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/175751#M6948</link>
      <description>&lt;P&gt;In the end I was able to pass such a file name using URL parameter arg, encoded using encodeURIComponent function. So it seems that "Dropbox-API-Arg" header is not really usable in multi-language scenarios.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 00:37:01 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/175751#M6948</guid>
      <dc:creator>Artem K.</dc:creator>
      <dc:date>2016-07-12T00:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: International characters in filenames</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/175752#M6949</link>
      <description>&lt;P&gt;API explorer seems to encode the same file path as "/\u043c\u043e\u044f \u0437\u0430\u043f\u0438\u0441\u044c.txt". OK, I just probably need to find the way to do this conversion in JavaScript.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 00:46:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/175752#M6949</guid>
      <dc:creator>Artem K.</dc:creator>
      <dc:date>2016-07-12T00:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: International characters in filenames</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/175753#M6950</link>
      <description>&lt;P&gt;Hi Artem, as you saw in the API Explorer, 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.&lt;/P&gt;
&lt;P&gt;Some, but not all, languages/libraries do this for you. For example, for JavaScript, to&amp;nbsp;do this yourself you could do something like this:&lt;/P&gt;
&lt;PRE&gt;var charsToEncode = /[\u007f-\uffff]/g;&lt;BR /&gt;&lt;BR /&gt;function http_header_safe_json(v) {&lt;BR /&gt; return JSON.stringify(v).replace(charsToEncode,&lt;BR /&gt; function(c) {&lt;BR /&gt; return '\\u' + ('000' + c.charCodeAt(0).toString(16)).slice(-4);&lt;BR /&gt; }&lt;BR /&gt; );&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;and then something like:&lt;/P&gt;
&lt;PRE&gt;'Dropbox-API-Arg': http_header_safe_json({ path: dropboxFilePath })&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jul 2016 23:49:12 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/175753#M6950</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-07-12T23:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: International characters in filenames</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/175754#M6951</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;Gregory,&lt;/P&gt;
&lt;P&gt;Ideally I would prefer to use some standard function instead of implementing encoding myself, but your example looks simple/robust enough.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 01:36:31 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/175754#M6951</guid>
      <dc:creator>Artem K.</dc:creator>
      <dc:date>2016-07-13T01:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: International characters in filenames</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/239408#M13305</link>
      <description>&lt;P&gt;There is Chinese in path like："/blackdog/中文prd.docx“，i see the api explore send Dropbox-API-Arg as follow:&lt;/P&gt;&lt;PRE&gt;Dropbox-API-Arg:{"path":"/blackdog/\u4e2d\u6587prd.docx"}&lt;/PRE&gt;&lt;P&gt;I am using java to implement http,my Dropbox-API-Arg as follow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;"Dropbox-API-Arg:  {"path":"/blackdog/\\u4E2D\\u6587prd.docx"}"&lt;/PRE&gt;&lt;P&gt;In java \\ standard for one \,and dropbox response as follow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;path/not_found/.&lt;/PRE&gt;&lt;P&gt;How could i resolve the issue?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 14:58:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/239408#M13305</guid>
      <dc:creator>jianwen</dc:creator>
      <dc:date>2017-08-31T14:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: International characters in filenames</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/239409#M13306</link>
      <description>&lt;P&gt;I try the url arg parameter as follow(url encoded):&lt;/P&gt;
&lt;PRE&gt;"POST /2/files/get_preview?arg=%257B%2522path%2522%253A%2522%252Fblackdog%252F%25E4%25B8%25AD%25E6%2596%2587PRD.docx%2522%257D HTTP/1.1[\r][\n]"
&lt;/PRE&gt;
&lt;P&gt;not work neither,get error as follow&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; "Error in call to API function "files/get_preview": URL parameter "arg": could not decode input as JSON[\r][\n]"
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 15:16:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/239409#M13306</guid>
      <dc:creator>jianwen</dc:creator>
      <dc:date>2017-08-31T15:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: International characters in filenames</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/239461#M13317</link>
      <description>&lt;P&gt;This may depend on your setup, but are you sure you need the double '/'? Have you tried it without it? i.e.,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;"Dropbox-API-Arg: {"path":"/blackdog/\u4e2d\u6587prd.docx"}"&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, we recommend either using &lt;A href="https://github.com/dropbox/dropbox-sdk-java" target="_self"&gt;the official Dropbox Java SDK&lt;/A&gt;, or having a library do the encoding for you. E.g., for Java, using Jackson, it would look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;JsonFactory f = ...
JsonGenerator g = f.createGenerator(...);
g.setHighestNonEscapedChar(0x7E);&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Aug 2017 19:39:26 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/239461#M13317</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-08-31T19:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: International characters in filenames</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/239497#M13319</link>
      <description>&lt;P&gt;Actually i use Jackson format json as follow:&lt;/P&gt;
&lt;PRE&gt;        String path = "/blackdog/中文PRD.docx";
        path = StringEscapeUtils.escapeJava(path);
        path_req.setPath(path);
        String header_json = JsonUtils.writeValue(path_req);
        LoggerUtils.logInfo(this.getClass(), header_json);&lt;/PRE&gt;
&lt;P&gt;In java double / standards /,so following code&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;"Dropbox-API-Arg: {"path":"/blackdog/\u4e2d\u6587prd.docx"}"&lt;/PRE&gt;
&lt;P&gt;is correct in Java.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 03:07:01 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/239497#M13319</guid>
      <dc:creator>jianwen</dc:creator>
      <dc:date>2017-09-01T03:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: International characters in filenames</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/239710#M13334</link>
      <description>&lt;P&gt;I debuged Dropbox java sdk,and the header Dropbox-API-Arg value is the same as mine&lt;/P&gt;
&lt;PRE&gt; "Dropbox-API-Arg:  {"path":"/blackdog/\\u4E2D\\u6587prd.docx"}[\r][\n]"
&lt;/PRE&gt;
&lt;P&gt;but i got 409 path/not_found/..,dropbox sdk get right response,i don not why.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="a4900c43ly1fj5n2pr0u3j20zv0emwgj" style="width: 999px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/1027iF92EEA8E6F2D6A0A/image-size/large?v=v2&amp;amp;px=999" role="button" title="a4900c43ly1fj5n2pr0u3j20zv0emwgj" alt="a4900c43ly1fj5n2pr0u3j20zv0emwgj" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2017 15:36:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/239710#M13334</guid>
      <dc:creator>jianwen</dc:creator>
      <dc:date>2017-09-02T15:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: International characters in filenames</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/240117#M13354</link>
      <description>It looks like you opened a new thread for this, so we'll follow up there:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropboxforum.com/t5/API-support/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240031#M13346" target="_blank"&gt;https://www.dropboxforum.com/t5/API-support/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240031#M13346&lt;/A&gt;</description>
      <pubDate>Tue, 05 Sep 2017 15:24:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/International-characters-in-filenames/m-p/240117#M13354</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-09-05T15:24:21Z</dc:date>
    </item>
  </channel>
</rss>

