private void enforceCorrectEncodingOfRequest() {

        String charset = NinjaConstant.UTF_8;

        String contentType = getHeader(CONTENT_TYPE);

        if (contentType != null) {
            charset = HttpHeaderUtils.getCharsetOfContentTypeOrUtf8(contentType);
        }

        try {
            httpServletRequest.setCharacterEncoding(charset);
        } catch (UnsupportedEncodingException e) {
            logger.error("Server does not support charset of content type: " + contentType);
        }

    }
private void enforceCorrectEncodingOfRequest() {

        String charset = NinjaConstant.UTF_8;

        String contentType = getHeader(CONTENT_TYPE);

        if (contentType != null) {
            charset = HttpHeaderUtils.getCharsetOfContentTypeOrUtf8(contentType);
        }

        try {
            httpServletRequest.setCharacterEncoding(charset);
        } catch (UnsupportedEncodingException e) {
            logger.error("Server does not support charset of content type: " + contentType);
        }

    }
private void enforceCorrectEncodingOfRequest ( ) { String charset = NinjaConstant . UTF_8 ; String contentType = getHeader ( CONTENT_TYPE ) ; if ( contentType != null ) { charset = HttpHeaderUtils . getCharsetOfContentTypeOrUtf8 ( contentType ) ; } try { httpServletRequest . setCharacterEncoding ( charset ) ; } catch ( UnsupportedEncodingException e ) { logger . error ( "Server does not support charset of content type: " + contentType ) ; } }
When a servlet engine gets a content type like: "application/json" it
assumes a default encoding of iso-xxxxx.

That is not what Ninja does (and is not consistent with default encodings
of application/json and application/xml).

Therefore we'll set utf-8 as request encoding if it is not set.
When a servlet engine gets a content type like : application / json it assumes a default encoding of iso - xxxxx .