commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jacky" <>
Subject Re: [fileupload] upload file with error encoding
Date Wed, 11 Jan 2006 04:39:12 GMT
So, how can i get the system encoding which is iso8859_15 not utf-8?
It seems that Systme.getProperty("file.encode") can't get the right encode.

     Best Regards.
  ----- Original Message ----- 
  From: jacky 
  Sent: Tuesday, January 10, 2006 4:44 PM
  Subject: [fileupload] upload file with error encoding

  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