<?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: Create folder / upload files with cURL POST and special characters in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129405#M35028</link>
    <description>&lt;P&gt;What is the output of these two commands (possibly your console is not using utf-8)?&lt;/P&gt;&lt;PRE&gt;locale
locale charmap&lt;/PRE&gt;</description>
    <pubDate>Mon, 15 Mar 2021 23:36:03 GMT</pubDate>
    <dc:creator>sufo</dc:creator>
    <dc:date>2021-03-15T23:36:03Z</dc:date>
    <item>
      <title>Create folder / upload files with cURL POST and special characters</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129402#M35025</link>
      <description>&lt;P&gt;Hi, I am trying to create a folder on Alfresco 6.2 using cURL and POST: everything works normally, except if the folder that I am trying to create contains some special characters (e.g. è ì à ù) in the name: these characters are not correctly interpreted and the folder is created with wrong name:&lt;/P&gt;&lt;PRE&gt;curl -X POST http://localhost/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/Sites/share/documentLibrary/files -H 'authorization: Basic XXXXXXXXXXXXX' -H 'content-type: multipart/form-data' -F cmisaction=createFolder -F 'propertyId[0]=cmis:objectTypeId' -F 'propertyValue[0]=cmis:folder' -F 'propertyId[1]=cmis:name' -F "propertyValue[1]=L'AGO...rùèàì" -F succinct=true&lt;/PRE&gt;&lt;P&gt;The resulting folder name in Alfresco is:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;"L'AGO...rÃ¹Ã¨Ã&amp;nbsp;Ã¬"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Is there a way to have these characters correctly interpreted?&lt;/P&gt;</description>
      <pubDate>Sat, 13 Mar 2021 17:57:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129402#M35025</guid>
      <dc:creator>sistemi</dc:creator>
      <dc:date>2021-03-13T17:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create folder / upload files with cURL POST and special characters</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129403#M35026</link>
      <description>&lt;P&gt;Try to specify utf-8 charset in the content-type header:&lt;/P&gt;&lt;PRE&gt;-H 'content-type: multipart/form-data; charset="utf-8"'&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Mar 2021 12:42:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129403#M35026</guid>
      <dc:creator>sufo</dc:creator>
      <dc:date>2021-03-15T12:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create folder / upload files with cURL POST and special characters</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129404#M35027</link>
      <description>&lt;P&gt;Hi, thanks for your answer, I tried but the resulting folder is the same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my request from command line:&lt;/P&gt;&lt;PRE&gt;root@test:# curl -X POST http://localhost/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/Sites/shareA/documentLibrary/fileTest -H 'authorization: Basic XXXXXXXXXXXXXXXXXXXXX' -H 'content-type: multipart/form-data; charset="utf-8"' -F cmisaction=createFolder -F 'propertyId[0]=cmis:objectTypeId' -F 'propertyValue[0]=cmis:folder' -F 'propertyId[1]=cmis:name' -F "propertyValue[1]=L'AGO...ràaèeiìoòuù" -F succinct=true&lt;/PRE&gt;&lt;P&gt;And here is Alfresco Answer, folder name contains wrong characters:&lt;/P&gt;&lt;PRE&gt;{"succinctProperties":{"cmis:objectId":"cba5f4ca-f6aa-4d00-b73b-755f0079ed66","alfcmis:nodeRef":"workspace:\/\/SpacesStore\/cba5f4ca-f6aa-4d00-b73b-755f0079ed66","cmis:path":"\/Sites\/shareA\/documentLibrary\/fileTest\/L'AGO...rÃ&amp;nbsp;aÃ¨eiÃ¬oÃ²uÃ¹","cmis:allowedChildObjectTypeIds":null,"cmis:lastModifiedBy":"admin","cmis:secondaryObjectTypeIds":["P:sys:localized"],"cmis:objectTypeId":"cmis:folder","cmis:description":null,"cmis:createdBy":"admin","cmis:baseTypeId":"cmis:folder","cmis:parentId":"532a7175-0851-45db-843a-b2bf111f0b75","cmis:creationDate":1615815273567,"cmis:changeToken":null,"cmis:name":"L'AGO...rÃ&amp;nbsp;aÃ¨eiÃ¬oÃ²uÃ¹","cmis:lastModificationDate":1615815273567},"propertiesExtension":{"aspects":{"appliedAspects":"P:sys:localized"}}}&lt;/PRE&gt;&lt;P&gt;And browsing folder from Alfresco share confirms that the name is wrong:&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="image.png" style="width: 400px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/1011i0D88B25CF0EB6094/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 13:44:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129404#M35027</guid>
      <dc:creator>sistemi</dc:creator>
      <dc:date>2021-03-15T13:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create folder / upload files with cURL POST and special characters</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129405#M35028</link>
      <description>&lt;P&gt;What is the output of these two commands (possibly your console is not using utf-8)?&lt;/P&gt;&lt;PRE&gt;locale
locale charmap&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Mar 2021 23:36:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129405#M35028</guid>
      <dc:creator>sufo</dc:creator>
      <dc:date>2021-03-15T23:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create folder / upload files with cURL POST and special characters</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129406#M35029</link>
      <description>&lt;P&gt;Hi, here is the output of the two commands:&lt;/P&gt;&lt;PRE&gt;root@test:~# locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


root@test:~# locale charmap
UTF-8&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Mar 2021 08:49:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129406#M35029</guid>
      <dc:creator>sistemi</dc:creator>
      <dc:date>2021-03-16T08:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create folder / upload files with cURL POST and special characters</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129407#M35030</link>
      <description>&lt;P&gt;I found out that either server or curl is not working properly. Only way for you to get it working is to prepare form data yourself in the file and send it with curl. We have it working in our implementation (not curl), because we are sending charset with each field:&lt;/P&gt;&lt;PRE&gt;-----------------------------1783cd3da56
Content-Disposition: form-data; name="cmisaction"
Content-Type: text/plain; charset=utf-8

createFolder
-----------------------------1783cd3da56
Content-Disposition: form-data; name="succinct"
Content-Type: text/plain; charset=utf-8

true
-----------------------------1783cd3da56
Content-Disposition: form-data; name="propertyId[0]"
Content-Type: text/plain; charset=utf-8

cmis:objectTypeId
-----------------------------1783cd3da56
Content-Disposition: form-data; name="propertyValue[0]"
Content-Type: text/plain; charset=utf-8

cmis:folder
-----------------------------1783cd3da56
Content-Disposition: form-data; name="propertyId[1]"
Content-Type: text/plain; charset=utf-8

cmis:name
-----------------------------1783cd3da56
Content-Disposition: form-data; name="propertyValue[1]"
Content-Type: text/plain; charset=utf-8

L'AGO...ràaèeiìoòuù
-----------------------------1783cd3da56--&lt;/PRE&gt;&lt;P&gt;curl sends it like this:&lt;/P&gt;&lt;PRE&gt;------------------------------ece9f7859ab7
Content-Disposition: form-data; name="cmisaction"

createFolder
------------------------------ece9f7859ab7&lt;/PRE&gt;&lt;P&gt;You can save first code block to a file test.txt and then you have to &lt;STRONG&gt;convert it to file with lines ending with CRLF&lt;/STRONG&gt; (Windows style) using:&lt;/P&gt;&lt;PRE&gt;perl -pe 's/\r?\n/\r\n/' test.txt &amp;gt; test-win.txt&lt;/PRE&gt;&lt;P&gt;And then send it like this:&lt;/P&gt;&lt;PRE&gt;curl -X POST http://localhost/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/Sites/shareA/documentLibrary/fileTest -H 'authorization: Basic XXXXXXXXXXXXXXXXXXXXX' -H "Content-Type: multipart/form-data; boundary=---------------------------1783cd3da56" --data-binary @test-win.txt&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Mar 2021 21:55:26 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129407#M35030</guid>
      <dc:creator>sufo</dc:creator>
      <dc:date>2021-03-16T21:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create folder / upload files with cURL POST and special characters</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129408#M35031</link>
      <description>&lt;P&gt;Hi, thanks&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/18925"&gt;@sufo&lt;/A&gt;&amp;nbsp;for your suggestion, it worked very well with folder creation!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can it be applied also to file upload? I tried to modify your suggestion by adding a "file" section, but the result is a file with correct name (including accented characters) but of 0 kb size.&lt;/P&gt;&lt;P&gt;Here is a CURL post that correctly uploads the file but does not encode correctly filenames:&lt;/P&gt;&lt;PRE&gt;curl -X POST 'http://localhost/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/Sites/share/documentLibrary/files' -H 'authorization: Basic XXXXXXXXXXXXX'  -H 'content-type: multipart/form-data' -F cmisaction=createDocument -F 'propertyId[0]=cmis:objectTypeId' -F 'propertyValue[0]=cmis:document' -F 'propertyId[1]=cmis:name' -F "propertyValue[1]=fileàèòìù.odt" -F "file=@/home/user/test.odt" -F succinct=true &lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Mar 2021 15:13:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-folder-upload-files-with-curl-post-and-special-characters/m-p/129408#M35031</guid>
      <dc:creator>sistemi</dc:creator>
      <dc:date>2021-03-19T15:13:51Z</dc:date>
    </item>
  </channel>
</rss>

