Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
58
rated 0 times [  62] [ 4]  / answers: 1 / hits: 20956  / 13 Years ago, thu, june 2, 2011, 12:00:00

I Have a Page where I search for a term and it is displaying perfect. Whatever character type it is.



Now when I have few checkboxes in JSP and I check it and submit. In these checkboxes I have one box name like ABC Farmacéutica Corporation.



When I click on submit button, I am calling a function and will set all parameters to a form and will submit that form. (I tested putting alert for the special character display before submit and it is displaying good).



Now, coming to the Java end, I use Springs Frame work. When I print the term in controller, then it is displayed like ABC Farmacéutica Corporation.



Please help...
Thanks in advance.



EDIT :



Please try this sample Example



import java.net.*;
class sample{
public static void main(String[] args){
try{
String aaa = ABC Farmacéutica Corporation;
String bbb = ABC Farmacéutica Corporation;

aaa = URLEncoder.encode(aaa, UTF-8);
bbb = URLDecoder.decode(bbb, UTF-8);

System.out.println(aaa +aaa);
System.out.println(bbb +bbb);

}catch(Exception e){
System.out.println(e);
}
}
}


I am getting output as,



aaa   PiSA+Farmac%C3%A9utica+Mexicana+Corporativo
bbb PiSA Farmacéutica Mexicana Corporativo


Try to print the string aaa as it is.


More From » java

 Answers
199

This is an encoding problem, and the à clearly identify that this is UTF-8 text interpreted as ISO-Latin-1 (or one of its cousins).



Ensure that your JSP-page at the top show that it uses UTF-8 encoding.


[#91902] Wednesday, June 1, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kamryn

Total Points: 645
Total Questions: 100
Total Answers: 118

Location: Tanzania
Member since Wed, Feb 24, 2021
3 Years ago
;