0

I need to POST form data using cURL, and one of the fields contains accented letters. Here is the command I am using (it is a command to create a folder on an Alfresco server):

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

But accented letters of propertyValue[1] field are not correctly interpreted, here is the part of the server response that reports the received parameter:

.... "cmis:name":"L'AGO...rùèàì" .... 

And on Alfresco system the folder is created with wrong name. Is there a way to correctly encode accented letters in a 'content-type: multipart/form-data' POST?

J.B.
  • 195
  • 3
  • 11
  • Does this answer your question? [How do I POST form data with UTF-8 encoding by using curl?](https://stackoverflow.com/questions/12489530/how-do-i-post-form-data-with-utf-8-encoding-by-using-curl) – 644 Mar 13 '21 at 17:12
  • I tried but it does not work. content-type in that answer is different, it uses application/x-www-form-urlencoded . If I try to use it in my curl POST, I receive "Unsupported: Unknown action" as answer. I also tried setting: 'content-type: multipart/form-data; charset=utf-8' but accented letters keep getting not correctly interpreted. – J.B. Mar 13 '21 at 17:45
  • I accepted the "duplicate question" proposal. Here is the working curl command: `curl -X POST http://localhost/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/Sites/share/documentLibrary/file -H 'authorization: Basic XXXXXXXXXX' -H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" --data-ascii cmisaction=createFolder --data-ascii 'propertyId[0]=cmis:objectTypeId' --data-ascii 'propertyValue[0]=cmis:folder' --data-ascii 'propertyId[1]=cmis:name' --data-ascii "propertyValue[1]=L'AGO...èìàò" --data-ascii succinct=true` – J.B. Mar 15 '21 at 14:33

0 Answers0