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 6834137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:04:27+00:00 2026-05-26T23:04:27+00:00

I instruct my URL to send an Ajax request like that: url += ‘/’

  • 0

I instruct my URL to send an Ajax request like that:

url += '/' + something + '/' + id;
var response;
$.ajax({
    async : false,
    type: 'DELETE',
    url: url,
 ...

My removeId is a variable that includes UTF-8 character. I will handle that variable at Java side like that:

@RequestMapping(value = "/something/{id}", method = RequestMethod.DELETE)
    public void myMethod(HttpServletResponse response, @PathVariable String id) {
    ...

However id variable at Java side is different from its original because UTF-8 characters changes to strange things.

How can I send UTF-8 characters from JavaScript side and transform it again at my Java side (Spring 3 with REST, my web server is Tomcat 7)?

PS 1: Even I don’t use encodeUriComponent it seems that my URL is encoding by itself?

PS 2: To make question more clear:

i.e. my id variable is araç and sent URL is: localhost:8080/sdfasf/ara%C3%A7 

When I see that id variable has that value:

araç

instead of:

ara%C3%A7 

Does Spring (or Tomcat) automatically do it? Is there any way to decode it automatically when it comes to controller as a path variable (I mean without writing anything as like:

URLDecoder.decode(id,"UTF-8");

it will be converted automatically)

  • 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-26T23:04:28+00:00Added an answer on May 26, 2026 at 11:04 pm

    The id value you see seems to be decoded using the iso-8859-1 charset instead of utf-8. The encoding of the path part of a url is not specified in java EE and there is no standard api to set it. For query parameters you can use request.setCharacterEncoding before accessing any parameters to have them decoded correctly. The CharacterEncodingFilter does exactly that but has no influence on path parameters.

    To make this work in Tomcat you have to set the URIEncoding attribute of the Connector element in its server.xml to “utf-8”.

    All you ever wanted to know about character encoding in a java webapp can be found in this excellent answer to a similar question.

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

Sidebar

Related Questions

I need a file system walker that I could instruct to ignore traversing directories
I basically need a url to open that will end up at the updates
How can I instruct the system to reload all kernel modules that have changed?
Is there a way that I can instruct WCF to accept JSON that is
is there a string in regular expressions that can instruct it to autoincrement it's
I've been asked to implement a security requirement that we instruct browsers not to
Is it possible to instruct the aspnet_compiler to set debug=false in the web.config? My
I am making a prompt in C# that instructs the user how to use
Is it possible to instruct GeSHi ( http://qbnz.com/highlighter/ ) to generate link to single
I have a server with a PHP script that pulls data from a source

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.