vixenpixie14
vixenpixie14

Reputation: 47

AEM xtype selection cannot display special characters

I am working on AEM 6.1 My problem is the selected options cannot display the characters when I select it. But the dropdown list displays the correct characters.selection dropdown list

here is the value when it is selected enter image description here

The return from the server is a JSON object with values {"text":"Др&#x443 ;гое","value":"?somequeryparametershere"}

Do I need to configure something in the dialog.xml? I checked the allowed attributes for the xtype="selection" which can help in the rendering the characters or encoding them to utf-8 but could not find any from this link https://docs.adobe.com/docs/en/cq/5-6/widgets-api/index.html?class=CQ.form.Selection#CQ.form.Selection-options

Dialog definition

<items jcr:primaryType="cq:WidgetCollection">
    <pageCategory 
        jcr:primaryType="cq:Widget" 
        fieldLabel="Page Category" 
        fieldDescription="A reload is required for changes to take effect. If changed: Press OK and then reload the page" defaultValue="Global select configured" 
        name="./pageCategory" 
        options="$PATH.categories.json" 
        type="select" 
        xtype="selection"/> 
</items>

Thanks in advance!

Upvotes: 1

Views: 960

Answers (1)

SubSul
SubSul

Reputation: 2563

@racs I just tried simulating this issue in my local. You will have to add this page directive in categories.json.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

Dropdown
Selection
Categories json

If you are using a templating language like sightly or handlebars, there will be changes in the syntax to include the page directive.

Upvotes: 1

Related Questions