Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7714981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:16:20+00:00 2026-06-01T02:16:20+00:00

This might be an obvious question. But I haven’t encountered this scenario before. In

  • 0

This might be an obvious question. But I haven’t encountered this scenario before.
In my Spring MVC application, I have the following configuration in web.xml.

<filter>
    <filter-name>characterEncodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
        <param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
    </init-param>
    <init-param>
        <param-name>forceEncoding</param-name>
        <param-value>true</param-value>
    </init-param>
</filter>


<filter-mapping>
    <filter-name>characterEncodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

The data transfer between the browser and the server occurs via JSON using Jackson Mapper.
The request – response headers as in Firebug is below:

Response headers
Content-Type    application/json;charset=UTF-8
Server          Apache
Transfer-Encoding   chunked

Request Headers
Accept  application/json, text/javascript, */*; q=0.01
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.5
Cache-Control   no-cache
Connection  keep-alive
Content-Length  0
Content-Type    application/json; charset=utf-8

Does this mean that the request-response is properly encoded?
Is looking at the headers the only way of determining the encoding used?

UPDATE

If as Polve mentions below, the settings affect only the interpretation as UTF-8, then what should I do encode my response in Spring MVC?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:16:22+00:00Added an answer on June 1, 2026 at 2:16 am

    The CharacterEncodingFilter only sets the encoding you want the other side to interpret the response (or request) as.

    The request does not says that you want UTF-8 via Accept-Charset, so the client can send whatever he wants, and your filter says that you will interpret it as utf-8, even if the client specified another encoding (forceEncoding=true).

    So no, it does not mean that your request is properly encoded, it says that you should interpret what is coming as utf-8.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This might sound like an obvious question but I can't seem to find the
This might be a really stupid and obvious question, but I'm very new to
This might sound like an obvious question, but I'm new to CouchDB, so I
This might be an obvious question. But am not able to figure it out
I'm new to JQuery so this question might be an obvious one, but I
I know this might be obvious, but bear with me my generic programming background
This might seem like a very easy question for some of you folks, but
This might be a simple question but I've searched and searched and can't find
This might be a very basic question but it confuses me. Can two different
This might sound like a stupid question but just trying to learn something here.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.