Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java : spécials caractéres

Status
Not open for further replies.

orahim77

Programmer
Dec 24, 2003
1
MA
Hello All,

In a servlet I recover my parameters as follows:

String subscriberNom = request.getParameter("nom")! = null? request.getParameter("nom"): "";

String subscriberPrenom = request.getParameter("prenom")! = null? request.getParameter("prenom"): "";

String subscriberTel = request.getParameter("tel")! = null? request.getParameter("tel"): "";

String subscriberEmail = request.getParameter("email")! = null? request.getParameter("email"): "";

These parameters are sent in JSP as follows: .
< form method=&quot;POST &quot;name=&quot;form_email&quot; action=&quot;/snw/newsEtpFather?task=Add &quot;>
< input name=&quot;nom&quot; type=&quot;text &quot;class=&quot;z&quot; size=&quot;25 &quot;>
< input name=&quot;prenom&quot; type=&quot;text &quot;class=&quot;z&quot; size=&quot;25 &quot;>
< input name=&quot;tel&quot; type=&quot;text &quot;class=&quot;z&quot; size=&quot;25 &quot;>
< input name=&quot;email&quot; type=&quot;text &quot;class=&quot;z&quot; size=&quot;25 &quot;>..

The problem that i have is that when the value of one of these parameters does contain a &quot;special&quot; character (like é an ' ), only the part before this character is recieved on my servlet

Example:

if I put in the field &quot;prenom&quot; the value &quot;prénom&quot;, the value recieved on the servlet is &quot;pr&quot;!!!!

I checked on the JSP and the values of the fields are well sent to the servlet.

Someone can say to me where is the problem.

Thank you in advance.
 
What character set you have set in your form page?

If you want to support acent character, you better use iso-8859-1. i.e. you need this HTML code in the header of your form page.

<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>

If you want to support Asian character set, you better use UTF-8. i.e.

<META HTTP-EQUIV=&quot;Content-Type&quot; CONTENT=&quot;text/html; charset=UTF-8&quot;>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top