formFile.setHeaderEncoding("UTF-8")
setHeaderEncoding does this:
"Specifies the character encoding to be used when reading the headers of individual parts. When not specified, or |null|, the platform default encoding is used."
If this was running on a English operating system it is probably defaulting to the Latin-1 encoding.
From this Java Doc: http://jakarta.apache.org/commons/fileupload/apidocs/org/apache/commons/fileupload/FileUploadBase.html#setHeaderEncoding(java.lang.String)
Please post back to the forum if this works. I would be interested in the result.
Zsolt Koppany wrote:
Hi,
my application has to support UTF-8 including when files are uploaded with UTF-8 characters in the filename (for example: ??????????????.txt).
I use a servlet filter that always call request.setCharacterEncoding("UTF-8") and my jsp pages contain response.setContentType("text/html; charset=UTF-8");
Everything works fine except that I have problems with decoding of the name of uploaded filenames.
I use the code below to get the name of the uploaded filename:
String nm = formFile.getFileName(); String filename = new String(nm.getBytes(), "UTF-8");
The code above converts only the first couple of characters correctly (result: ??????????????????????.txt).
Any ideas how to fix the problem?
I use TC-4.1.29, Struts-1.1, jdk1.4.2_02 Windows-XP.
Zsolt
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Jason Lea
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]