commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jacky" <>
Subject [fileupload] upload file with error encoding
Date Tue, 10 Jan 2006 08:44:23 GMT
linux redhat7.3 j2sdk1.4.2 Tomcat4.1.30, common-fileupload1.0

        String docDestRelativePath = getPath(); //getPath() will generate the relative path
        String docDestAbsPath = getServletContext().getRealPath(docDestRelativePath);
        File docDestAbsPathFile = new File(docDestAbsPath);

        String relativePath = "test/4867.txt";
        String path = getServletContext().getRealPath(relativePath) ;
        File pathFile = new File(path);

        abstractItem.write(pathFile);               //line 1,
        abstractItem.write(docDestAbsPathFile);     //line 2

line 1 write the file with right encoding, but the line 2 write the file with funny txt. 
When using System.getProperty("file.encode") before line 1, after line 1 and after line 2,
all print utf-8. I think it maybe the encoding of tomcat container because the encoding of
my system is iso8859_15.

I don't know why this happens. What can i do to make the line 1 work?  Thanks for your help!

     Best Regards.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message