commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Atlas" <>
Subject Help with JSP parsing form data for UTF-8 charsets?
Date Tue, 07 Feb 2006 18:49:16 GMT

I am trying to update a MySQL database record with UTF-8 characters with my JSP application.
I am using FileUpload to process multipart form data that may also contain UTF-8 characters.

1) I have MySQL correctly configured to handle UTF8 and have tested insert/update/select with
UTF8 characters

2) I have an "editRecord.jsp" page. At the top of the page, I specify:

<% request.setCharacterEncoding("UTF-8"); %>

3) I have an input form which is specified in that page which follows:
<form action="<c:url value="/updateRecord.jsp"/>"
name="updatetForm" method="post"

4) I have a servlet filter that takes every HttpServletRequest and modifies that object in

5) In updateRecord.jsp, I fill a JavaBean with the form data. Here's an example of the form

name = Company
Comments=Here's some unicode text: "(chinese text) test"

I see:
name = Company
Comments=Here's some unicode text: "خار..test"

6) In my JSP updateBean I am using the FileUpload class:
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);

7) When I put a breakpoint and inspect the contents of the "comments" form item after posting
the form, I see

Here's some unicode text: "خار....test"

Where could I possibly be missing something to force UTF8 encoding of these values? 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message