Question

I'm trying to make a simple search engine for my schoolproject, which searches for an item in the database. I just a form that submits to a servlet which does the search. The form submit method I'm using is GET.

When I do a search containing special characters eg. the danish Æ, Ø and Å the search does not return any result.

Let take an example. I search for the word "mælk". The querystring in the URL looks fine, but when I debug I see that my database manager receives the word "mælk".

I have tried this to get rid of it:

String search = java.net.URLDecoder.decode(name, "UTF-8");

Where name, is the parameter received from the querystring. However it did not work.

Does anyone have any idea?

Thank you in advance.

Was it helpful?

Solution

Try use this:

request.setCharacterEncoding("UTF-8");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top