Others
may have a better answer. You should try a System.out.println() of your m_Idioma
in the code to see what it looks like when it gets to your servlet.
I
suspect you submit this value from an HTML Form and somehow the string is being
encoded in one way by the browser and decoded in another by the servlet.
There are numerous problems already documented with the class URLEncoder because
of locale mismatches between the client and the server.
Make
sure the language settings on each machine (and browsers) match and this problem
should go away.
I had
a similar problem and finally abandoned using URLEncoder. I now expand every
unicode value to HEX and back in URLs/Forms to avoid this
nightmare.
J.D>
Hi,
I'm having a strange problem. I'm developing a J2EE Web
Application, with Entity Beans, Servlets, JSPs and so on. I've started
to get character conversion problems, and I've isolated the piece of code
giving me problems.
The code is:
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver()); Connection con =
DriverManager.getConnection ("jdbc:oracle:thin:@oraclehost:1521:orcl",
"user", "password"); dumpTable(con, out); String updateStatement =
"UPDATE IDIOMAS SET IDIOMA = ? WHERE IDIDIOMA = ? "; PreparedStatement
prepStmt = con.prepareStatement (updateStatement);
prepStmt.setString(1, m_Idioma); prepStmt.setLong(2, m_Id);
prepStmt.executeUpdate(); prepStmt.close(); con.close();
Where "m_Idioma", which is a standard java.lang.String, which
eventually is "Español", and m_Id is a long with the primary key of
the record I want to update.
If I paste this code into a JSP, then I
get the desired result, BUT, if I paste and run the code from a Servlet
(exactly the same code), then my "Español" becomes "Espaýol"... I've
tried almost everything, I've runned the Servlet on the J2EE server
and locally whit the debugger, and the same result.
My DataBase server
is a Oracle 8.1.7 Database, and I'm using Oracle 9i Application Server
OC4J (the Orion AS).
The problem is the same with "á", "é", "í"
and so on.
I'll apreciate any kind of help you can give me.
Thanks in advance, and please forgive my English.
Gustavo
Comba
|