Hello,

I have a website using :

- Struts 1.3
- Hibernate 3.2
- Tomcat 5.5
- Java 1.5.0
- MySQL 4.1.22

All my site and my database are encoded in UTF-8.

When I enter in a form the character e-accute, it becomes an 'A' with
a tild, following by a (c) (copyright character). I've made several
tests to find where the problem is.

In the Struts Action which handles the form, I've put this code :

System.out.println("Default Charset : " + Charset.defaultCharset());
System.out.println(request.getParameter("name") + " : " +
request.getParameter("name").getBytes("UTF-8").length);

which gives me :

Default Charset : windows-1252
Ã(c) : 4

It means that somewhere (from the form to the Struts Action), there's
a component which interpret the e-accute character with the latin1
encoding (ISO-8859-1). The result is that it sees TWO characters
(where it should only sees ONE character encoded by TWO bytes). When I
arrive to my Struts Action, my parameter is already the "A-tild (c)"
encoded IN UTF-8, and then encoded BY 4 bytes.

Anyone can help me to understand the problem and how to solve it ?

Thanks in advance,

piloupy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to