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

  • Home
  • SEARCH
  • 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 7013069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:20:19+00:00 2026-05-27T22:20:19+00:00

I have read through the post Who sets response content-type in Spring MVC (@ResponseBody)

  • 0

I have read through the post “Who sets response content-type in Spring MVC (@ResponseBody)“, it helped me to resolve my problem of displaying UTF-8 (CJK characters) data at client side using JSON method.

Now find I have problem to post UTF-8 data to server side using JSON. The javascript method I am using:

function startSomething() {

    console.log("startSomething()");
    console.log("  getOriginName() = " + getOriginName());
    console.log("  getDestinationName() = " + getDestinationName());

    $.ajaxSetup({ scriptCharset: "utf-8" , 
                  contentType: "application/json; charset=utf-8"});

    // send the data to server side
    $.ajax({
        url: "/mywebapp/something/start",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        data: {
            originName          : getOriginName(),
            destinationName     : getDestinationName()
        },
        success: function(response) {
            // do something
        }
    });
}

After triggering the javascript method, I can see the value printed out in browser console correctly, something as:

  getOriginName() = N Bridge Rd
  getDestinationName() = 夢幻之城@ Boat Quay

My server side code:

@RequestMapping("/something")
@Controller
public class TestController {

    // the logger
    private Logger logger = Logger.getLogger(TestController.class);

    @RequestMapping(value = "/start", method = RequestMethod.GET)
    public ResponseEntity<String> start(@RequestParam String originName, 
                                        @RequestParam String destinationName,
                                        HttpServletRequest request, 
                                        HttpServletResponse response) {

        String characterEncoding = request.getCharacterEncoding();
        String contentType = request.getContentType();

        logger.debug("  characterEncoding = " + characterEncoding);
        logger.debug("  contentType = " + contentType);

        if (logger.isDebugEnabled()) {
            String logMessage = StringUtils.join(
                    new Object[]{
                            "  originName = ", originName,
                            "  destinationName = ", destinationName
                    }
            );
            logger.debug(logMessage);
        }

        ...
    }
}

The output from my server side code:

TestController -   characterEncoding = UTF-8
TestController -   contentType = application/json; charset=utf-8
TestController -   originName = N Bridge Rd  destinationName = 夢幻ä¹å@ Boat Quay

You can see that the request encoding is UTF-8, but the value from client side is wrongly encoded CJK character.

What can go wrong here? Please give me some hints, thank you.
George

  • 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-05-27T22:20:19+00:00Added an answer on May 27, 2026 at 10:20 pm

    I had a similar problem with JSON & Spring and solved the issue by specifying URIEncoding="UTF-8" on <Connector> in my Tomcat server.xml config, as described here:

    http://wiki.apache.org/tomcat/FAQ/CharacterEncoding#Q8

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

Sidebar

Related Questions

I have read through Scott Hanselman's post on this topic. I found another article
I've read through all of the Spring 3 Web docs: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/spring-web.html but have been
I have read through several reviews on Amazon and some books seem outdated. I
I have read through the solutions to similar problems, but they all seem to
I have read through the Rails docs for Routing , Restful Resources , and
Okay guys, I have read through all the other posts and question on jQuery
Ok, I'm programming in objective-C and using Xcode. I have read through the documentation
I'm trying to have my application read through a text file and look for
I have read the boost asio reference, gone through the tutorial and looked at
I have a web server which is protected behind http-basic-auth. I've read through the

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.