struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zsolt Koppany" <zkoppanyl...@intland.com>
Subject RE: What is wrong with this upload filename (UTF-8) decoding?
Date Fri, 26 Dec 2003 10:51:35 GMT
After posting now I see that the posted email contains "?" characters
instead of the original chinese characters I used in my example.

Zsolt

> -----Original Message-----
> From: Zsolt Koppany [mailto:zkoppanylist@intland.com]
> Sent: Friday, December 26, 2003 11:45 AM
> To: Struts Users Mailing List
> Subject: What is wrong with this upload filename (UTF-8) decoding?
>
>
> 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: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message