Home > Blog > Computers & Internet > fileupload文字化け@Struts1.1

fileupload文字化け@Struts1.1

Struts1.1 fileuploadでの日本語ファイル名の文字化けの件
ファイル名の変換だけなら下記メソッドをしようすればいけます。

    /******************************************
     * ファイル名の変換(文字化け対策)
     * @param file  変換前のファイル情報
     * @throws Exception  例外が発生した場合
     *****************************************/
     private void encodeFileName(FormFile file) throws Exception {
         if (!"".equals(file.getFileName())) {
             file.setFileName(new String(file.getFileName().getBytes("iso-8859-1")
            , "JISAutoDetect"));
         }
     }

Struts1.2を使用すればなにも問題ないみたいだけど。。。
たまにはまじめにw

このブログで関連すると思われる他のエントリ

Comments:0

Comment Form
Remember personal info

Trackbacks:0

Trackback URL for this entry
http://clare-chronicle.net/2007/12/fileupload%e6%96%87%e5%ad%97%e5%8c%96%e3%81%91struts11/trackback/
Listed below are links to weblogs that reference
fileupload文字化け@Struts1.1 from Clare Chronicle

Home > Computers & Internet > fileupload文字化け@Struts1.1

Return to page top