tags:

views:

174

answers:

2

I have a jsp page(let's say page1.jsp) which have an html form with action="page2.jsp". In page1.jsp and page2.jsp i have <%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%> outside the head section and <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> in the head section.

If i write greek letters in the form i see in the url(get method) something like that http://localhost:8080//addProblem.jsp?lastNameForm=%CF%84%CF%85%CE%B8%CF%84%CF%85%CE%B8%CF%84%CF%85&amp;firstNameForm=&amp;eMa ....

and from page2.Jsp with the use of <% out.println(request.getParameter("lastNameForm")); %>

i get this αÏδαÏδ What can i do?

+2  A: 

try

request.setCharacterEncoding("utf-8");

at the top of your 2nd jsp

Bozho
This won't work for GET query parameters.
BalusC
@Argiropoulos Stavros see BalusC's answer
Bozho
+2  A: 

Thus, you want to URL-decode GET request parameters using UTF-8 character encoding. For URL-decoding GET request parameters you need to set the character encoding in the server configuration. How to do it depends on the server in question, best is to refer its documentation using the keywords "uri encoding". In for example Tomcat you need to set the URIEncoding attribute of the <Connector> element for HTTP requests in the server.xml, also see this document:

<Connector (...) URIEncoding="UTF-8" />

The HttpServletRequest#setCharacterEncoding() as Bozho mentioned only works for POST requests where the parameters are included in the request body instead of in the URL.

For more background information and a detailed overview of all solutions you may find this article useful.

BalusC
I was about to write about the connector but was a bit busy (read: lazy) :) (+1)
Bozho
The real problem is that want to send a gDataRequest as shown here http://code.google.com/intl/el-GR/apis/fusiontables/docs/sample_code.html If in the runUpdate(updateQuery) function the updateQuery contains greek characters i still have the same problem despite the server configuration changes as you instructed.Please take a look Thank you
Argiropoulos Stavros
That code behind the link looks completely different than you have shown in the topicstart. I also cannot correlate the one with the other. Now I am confused, because it's impossible that you "still have the same problem". Maybe you meant to say that you still get those characters, but now at a different place/situation? You should ask a new question then.
BalusC
I did ask a separate question but it was not answered by anyone...http://stackoverflow.com/questions/2271970/google-fusion-tables-api-url-encoding
Argiropoulos Stavros