1

I am taking variable names from a path variable in my spring application.

However that fails in some cases when URL contains special characters

For e.g. http://www.loudletters.com/ll/rest/celebrityprofile/2S/Jan%20Min%C3%83%C2%A1%C3%85%C2%99 gives page not found error.

How to handle this?

1
  • 1
    Can you provide a code sample showing how you're constructing your URL from the Sting? Commented Apr 10, 2011 at 13:17

2 Answers 2

3

I handle UTF-8 path variables just fine. What you need to do is:

  • set UTF-8 for URIs in your servlet container configuration
  • read the input as utf-8 (probably using spring's CharacterEncodingFilter)

The encoding and decoding should be done automatically by the servlet container and the browser.

Sign up to request clarification or add additional context in comments.

1 Comment

@Bozho voting up for nice link.
2

Have you considered the use of java.net.URLDecoder and java.net.URLEncoder?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.