Java Servlet p_request.getParameter return wrong encoding

Hi friends,
In our add-on for Confluence Server we send data to a servlet via POST request.

In the servlet, when we retrieve the content of the POST using p_request.getParameter(parameterName) the encoding of the data is wrong (i.e. not UTF-8 as expected).

The same code/add-on works well in JIRA Server.

Is there any setting to be used in order to retrieve the data in the right encoding?

It turns out that the POST request has to explicitly set the charset otherwise the HttpServletRequest.getCharacterEncoding() would return a null value and the default encoding applied by the Tomcat Servlet will be not UTF-8.

e.g req.set(‘Content-Type’, ‘application/x-www-form-urlencoded; charset=UTF-8’);

For the record, the charset has to be explicitly set in the response of the servlet too (e.g. response.setContentType(“application/json; charset=utf-8”);

I would expect that the default charset would be UTF-8, but it seems not the case in Confluence Server (it is in JIRA Server)