1

I have a simple dashboard with items, and each item can have several tags. Now I'm implementing filtering functionality, when user clicks a tag, all item with that will be shown.

At the server side I'm rendering the webpage using JSTL <c:url /> with <c:param /> so in the source code it looks like this:

<a href="/dashboard?filter=k%c5%af%c5%88">kůň</a>

The problem is, that when I click the link, my browser actually decodes the string and it sends following to server: /dashboard?filter=kůň

The thing it, that this isn't valid URL so on the way over network it gets mangled and the server actually recieves /dashboard?filter=kůÅ.

Everything on my webpage and server is set to use UTF-8. And this problem doesn't happen when using POST and sending UTF-8 data from form.

Is there any way to stop the browser from decoding the string?

I have tried Firefox and Chrome, but I don't think it's of any significance.

UPDATE: To clarify I want to recieve percent encoded string on my server, so I can safely decode it.

UPDATE2: I did some research on the letters, the problem is. That LATIN SMALL LETTER U WITH RING ABOVE (ů) is encoded as two bytes - 0xC5 0xAF. And Java treats each byte as single character. So 0xC5 becomes LATIN CAPITAL LETTER A WITH RING ABOVE - Å. And so on.

jnovacho
  • 2,825
  • 6
  • 27
  • 44
  • possible duplicate of [HttpServletRequest UTF-8 Encoding](http://stackoverflow.com/questions/16527576/httpservletrequest-utf-8-encoding) – jnovacho Jan 06 '14 at 07:53

1 Answers1

0

EDIT: I have found solution in this question: HttpServletRequest UTF-8 Encoding

So far the best idea I have for solving this program, would be to discard the fulltext from QueryString. I can replace the tag string with corresponding ID from database, which in turn will solve the encoding problem.

Community
  • 1
  • 1
jnovacho
  • 2,825
  • 6
  • 27
  • 44