Expand my Community achievements bar.

Special characters rendering issue on dispatcher

Avatar

Level 1

Hi Team,

 

We are facing issue with rendering of special character like é from request parameter and it renders as ? on page source on dispatcher url, where as on publishers renders fine.

We checked the org.apache.sling.engine.parameters settings and utf-8 is set and dispatcher httpd.conf also UTF-8 is set as

AddDefaultCharset utf-8

 

url - example 

 

http://localhost:4502/content/abc/en/home/search.html?model=coupé

 

from publishers renders character fine but dispatcher shows on page as 

coup?

 

Also when try hitting like http://localhost:4502/content/abc/en/home/search.html?model=coupé&_charset_=ISO-8859-1

 

renders character fine on dispatcher.

on page 

<meta charset="UTF-8"/>
 

is already set.

 

Kindly share on inputs to check on same.

2 Replies

Avatar

Community Advisor

Hi

 

I think you just need to encode and decode the text properly, you should do something like this:

1. Invoke your search with text decoded

search?model=coup%C3%A9

Then in your Java code, you could use something like this to decode:

String result = java.net.URLDecoder.decode(url, StandardCharsets.UTF_8);

 

Tool Reference: https://meyerweb.com/eric/tools/dencoder/

 

Hope this helps



Esteban Bustamante