Hi guys,
Today I just want to share with you a way to post Chinese characters (or special characters) to AEM using cURL. This all started with me trying to restart an asset workflow using cURL. Here you can find instructions on how to do so, the example relevant to this post from that article is:
curl -u admin:admin -d "model=/etc/workflow/models/request_for_activation/jcr:content/model&payload=/content/geometrixx/en/company&payloadType=JCR_PATH&workflowTitle=myWorkflowTitle" http://localhost:4502/etc/workflow/instances
If your "payload" request parameter contains Chinese characters, after you execute this command you will notice the Chinese name on AEM has been corrupted. So to get started I modified the above command as follows:
curl -v -u admin:admin -F model="/etc/workflow/models/dam/update_asset/jcr:content/model" -F payloadType="JCR_PATH" -F payload="/content/dam/何塞.png" http://localhost:4502/etc/workflow/instances
After executing it my payload would look like this on AEM: /content/dam/ä½å¡.png
If you add _charset_="utf-8" to your parameters in the cURL command the Chinese name would be posted correctly. So the final version of the command looks like this:
curl -v -u admin:admin -F model="/etc/workflow/models/dam/update_asset/jcr:content/model" -F payloadType="JCR_PATH" -F payload="/content/dam/何塞.png" -F _charset_="utf-8" http://localhost:4502/etc/workflow/instances
Now my payload name on AEM displays and executes correctly as: /content/dam/何塞.png
During the time of my research I came across this article where you will find another workaround to post special characters to AEM. In this article I found this command:
curl -u admin:admin -X POST --data "test=€ , Š , Œ , ™ , š , œ , ž" http://localhost:4502/content/mynodetest
Which is incapable of posting those special characters to AEM (they get corrupted once they are in AEM). I modified it as follows:
curl -v -u admin:admin -F test="€ , Š , Œ , ™ , š , œ , ž" -F _charset_="utf-8" http://localhost:4502/content/mynodetest
And voila! problem solved, special characters posted correctly to AEM
Hope this helps anyone out there looking for a simple solution to this, including myself in case I forget it in the future
Hi
This is Excellent read. Thank you for sharing this solution to the community.
This will help the mass.
Thanks and Regards
Kautuk Sahni
Views
Replies
Total Likes
Hi,
This is Excellent, finally my issue is solved!!!
Thanks,
Naresh N.
Views
Likes
Replies
Views
Likes
Replies