cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "roy huang" <>
Subject [Help]How to get uploaded file name using different form-encoding(ever post in user mail-list)?
Date Wed, 21 Apr 2004 14:41:20 GMT
I post this mail yestoday,no one response,so I repost here hope get help.

    This's a strange question stuff me up.I set form-encoding to utf-8 in web.xml for display
and submit.I can use this code to get the correct string in Chinese,the form encoding is utf-8:
    userName = new String(request.getParameter(nameField).getBytes("ISO-8859-1"));
    But in the same time I use an activex control to upload file,the control is to generate
an html form and submit ,it's form encoding is ISO-8859-1,here comes the problem.
     Part part = (Part) request.get(this.fileField);
     String tmp = part.getFileName();
     String fileName = new String(tmp.getBytes("ISO-8859-1"));
    the Chinese fileName becomes something like ???????????????????.pdf.
    I try to solve it:
    1.If I change form-encoding back to default,the fileName is ok,but my other application
using utf-8 encoding is wrong
    2.I use SetCharacterEncodingAction like:
   <map:act type="formencoding">
    <map:parameter name="form-encoding" value="ISO-8859-1" />
   ... upload thing
   but it doesn't work ,though I print the request.getCharacterEncoding() and see "ISO-8859-1",I
believe the fileupload is still using the default form-encoding utf-8.

How can I solve this problem?

Roy Huang
View raw message