I have a question for any Java gurus with i18n experience. I'm having
a hard time understanding the way things work with a webapp --
actually why it doesn't work. Here's what's going on... I have a
web-based admin that contains an HTML textarea field in which users
enter in text. Often the text contains special Windows characters
(such as curly quotes) and Latin-1 characters for words like
"naiveté". In a servlet, I use the HttpServletRequest.getParameter()
method to retrieve the text and dump it into a MySQL database that
uses Latin1 as its default charset. That works fine -- no problems.
The text can later be viewed fine through a web page as well as
through Mysql Control Center.
The problem occurs with another Java program I wrote which iterates
over the database records, does some string manipulation to the text,
and updates the records. After this program is run, all of the
Windows characters and Latin1 characters show up as garbage text.
So, I'm wondering why, in each case, I do nothing special to convert
character sets, but it works for the initial insert, but not for the
update. Why does my web-based app using
HttpServletRequest.getParameter() seem to handle character sets
differently than my standalone app using JDBC? Each are run on the
same machine.
Any help would be appreciated.
Thanks!
Justin
|