I am using querybuilder to read the properties of some text components. If I enter UTF8 chars (e.g ü) into the Adobe author editor (and I can see from the page source that its set to UTF8), I get ISO-8859-1 out.
When I get the ValueMap from the component in a servlet, I write the results to a file, and to the servlet response writer also. In the file, if I open it as a ISO-8859-1 I see ü. If i open it as a utf8 file (in VS code), i get a back "?". In postman I see a black "?" and also on the resultant webpage (which has utf8 set in the header).
NOTE: we have set the servlet parameter encoding to UTF8 in the OSGi config as per: http://adobeaemtips.blogspot.com/2015/11/utf-8-encoding-in-aem.html
FYI, I also tried with Content-Type: application/json; charset=utf-8 request header.
Solved! Go to Solution.
You can add this as an OSGi config with org.apache.sling.engine.impl.SlingMainServlet as sling.additional.response.headers property and checkin via code. It will be available for all developers.
Hi. I have created a file called ../config/org.apache.engine.impl.SlingMainServlet.cfg.json, but am not sure what to put in it. My guess would be:
But presumably this will overwrite the existing 2 defined headers?
The osgi editor page says this|:
Provides mappings for additional response headers Each entry is of the form 'bundleId [ ":" responseHeaderName ] "=" responseHeaderValue' (sling.additional.response.headers)
But this makes no sense - in json, you have xxx:"yyy", but this is saying we should be using :xxx=yyy which seems wrong.
Please create a file with org.apache.sling.engine.impl.SlingMainServlet.cfg.json name under the config folder.
Add the below content to it.