By default, you cannot post strings to AEM that contain special characters. For example, you cannot run this CURL command to post special characters to AEM.
curl -H "charset=utf-8" -u admin:admin -X POST --data "test=€ , Š , Œ , ™ , š , œ , ž" http://localhost:4502/content/mynodetest
If you attempt this command with CURL, wrong characters are inserted into AEM. That is, you will see: "Ç , è , î , Ö , Ü , £ , P , Ä , " instead of "€ , Š , Œ , ™ , š , œ , ž , Ž , Ÿ".
To successfully post special characters to AEM and use them to set node values in the AEM JCR, you have to create a custom Sling Servlet that is able to handle UTF-8 (UCS Transformation Format—8-bit) encoded strings. This encoding type is a variable-width encoding that represents every character in the Unicode character set.
The Sling Servlet can decode the strings that contain special characters using Java application logic.
String id = java.net.URLDecoder.decode(request.getParameter("id"), "UTF-8");
String firstName = java.net.URLDecoder.decode(request.getParameter("firstName"),"UTF-8");
To post these special characters to the AEM Sling Servlet, encode the strings, as shown in this Java code example.
String val = java.net.URLEncoder.encode("cust®", "UTF-8");
String firstName = java.net.URLEncoder.encode("TOM®", "UTF-8");
To read this development article, click, http://helpx.adobe.com/experience-manager/using/post_chars.html.
Join the Adobe Experience Cloud Community
Join the Adobe Experience Cloud Community by clicking this banner
I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with 20 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.
Twitter: Follow the Digital Marketing Customer Care team on Twitter @AdobeExpCare.
YouTube: Subscribe to the AEM Community Channel.
Twitter: Follow the Digital Marketing Customer Care team on Twitter @AdobeExpCare.