Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 61529 invoked from network); 7 Feb 2006 19:57:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Feb 2006 19:57:05 -0000 Received: (qmail 70869 invoked by uid 500); 7 Feb 2006 19:56:44 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 70816 invoked by uid 500); 7 Feb 2006 19:56:43 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 70805 invoked by uid 99); 7 Feb 2006 19:56:43 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2006 11:56:43 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [199.88.205.1] (HELO mail2.basistech.net) (199.88.205.1) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2006 11:56:40 -0800 Received: from mail3.basistech.net ([10.1.1.99]) by mail2.basistech.net with Microsoft SMTPSVC(6.0.3790.1830); Tue, 7 Feb 2006 14:56:19 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1256" Content-Transfer-Encoding: quoted-printable Subject: RE: Help with JSP parsing form data for UTF-8 charsets? Date: Tue, 7 Feb 2006 14:56:18 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Help with JSP parsing form data for UTF-8 charsets? Thread-Index: AcYsGJk2EuAPe5yXTLi8re16Sv4DvAAABClgAAHE/BA= From: "Michael Atlas" To: "Jakarta Commons Users List" X-OriginalArrivalTime: 07 Feb 2006 19:56:19.0665 (UTC) FILETIME=[9035AC10:01C62C20] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hello, I found a fix for this. Hi everyone: Here's some good information here that solved my problem of processing = multipart form data containing UTF-8 (unicode) characters in Commons = FileUpload: http://www.theserverside.com/discussions/thread.tss?thread_id=3D28944 Here's a snippet of my code that processes the UTF-8 form data using = Commons FileUpload: http://java.pastebin.ca/40594 The most important lines are 9 and 26: upload.setHeaderEncoding("UTF-8"); ... String value =3D new String(item.getString().getBytes("ISO-8859-1"), = "UTF-8"); ... -----Original Message----- From: Michael Atlas [mailto:MAtlas@basistech.com]=20 Sent: Tuesday, February 07, 2006 2:01 PM To: Jakarta Commons Users List Subject: RE: Help with JSP parsing form data for UTF-8 charsets? Hi Martin. Thanks for the quick response. I have recently added that to = my my HTML header with no luck. Any other ideas? In the meantime, I will = continue looking..=20 -----Original Message----- From: mfncooper@gmail.com [mailto:mfncooper@gmail.com] On Behalf Of = Martin Cooper Sent: Tuesday, February 07, 2006 1:59 PM To: Jakarta Commons Users List Subject: Re: Help with JSP parsing form data for UTF-8 charsets? It looks like you forgot to tell the browser. Try adding: -- Martin Cooper On 2/7/06, Michael Atlas wrote: > > Hello, > > I am trying to update a MySQL database record with UTF-8 characters=20 > with my JSP application. I am using FileUpload to process multipart=20 > form data that may also contain UTF-8 characters. > > 1) I have MySQL correctly configured to handle UTF8 and have tested=20 > 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: >
" > name=3D"updatetForm" method=3D"post" > ACCEPT-CHARSET=3D"UTF-8" > enctype=3D"multipart/form-data"> > > 4) I have a servlet filter that takes every HttpServletRequest and=20 > modifies that object in doFilter(...){ ... > request.setCharacterEncoding("UTF-8"); > chain.doFilter(...) > } > > 5) In updateRecord.jsp, I fill a JavaBean with the form data. Here's=20 > an example of the form input: > > name =3D Company > Comments=3DHere's some unicode text: "(chinese text) test" > > I see: > name =3D Company > Comments=3DHere's some unicode text: "=CE=C7=D1..test" > > 6) In my JSP updateBean I am using the FileUpload class: > FileItemFactory factory =3D new DiskFileItemFactory(); = ServletFileUpload=20 > upload =3D new ServletFileUpload(factory);=20 > upload.setHeaderEncoding("UTF-8"); > .... > > 7) When I put a breakpoint and inspect the contents of the "comments"=20 > form item after posting the form, I see > > Here's some unicode text: "=CE=C7=D1....test" > > Where could I possibly be missing something to force UTF8 encoding of=20 > these values? > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org