-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Sylvie,
On 9/17/2009 9:12 AM, Sylvie Perrin wrote: > I have a shared directory on a windows system named SHAREDDIR and > containing one file named "fichié.txt" > I mount this shared directory on my Linux system with the following > command: >> mount -t cifs -o iocharset=utf8 //IpWindows/SHAREDDIR /home/me/mountDir/ > > In a standalone Java application running on my Linux system, I can > create a FileInputStream from the file located in the remote directory > like this: > > String mountPath = "/home/me/mountDir"; > File[] list = new File(mountPath).listFiles(); > File file = list[0]; > try { > FileInputStream fStream = new FileInputStream(file); > } > catch (FileNotFoundException e) { > e.printStackTrace(); > } Can you have your standalone Java program print the following information: 1. The full path of the file 2. The values for these system properties: a. file.encoding b. sun.jnu.encoding > When I execute the same code in a servlet running on the same machine, > the call to FileInputStream constructor always throws a > FileNotFountException because it doesn't recognize the "é" character in > the path of the file. Please post the above values within your servlet environment, too. Are you sure that it's because of the é, or is it because the user that Tomcat is running under does not have permission to read that file? Under what user /is/ Tomcat running? > Since I don't know what the problem is I have had a hard time tracking > down a solution online. I especialy take care to follow all steps > described in the FAQ/CharacterEncoding parts of wiki. Here is my > configuration: > > I set URIEncoding in my port 8080 connector to UTF-8 (I use this port to > execute my servlet) > <Connector port="8080" protocol="HTTP/1.1" > connectionTimeout="20000" > redirectPort="8443" > URIEncoding="UTF-8" > useBodyEncodingForURI="true" /> None of these settings matter. These are only relevant for HTTP communication, and your code is not reading anything from the request. > I use a filter to set the default encoding to UTF-8 and my first line of > my doFilter method is > request.setCharacterEncoding("UTF-8"); Your filter sets /what/ default encoding? What does it set it to? Setting the encoding of the request will not affect your code above. > I add in my servlet the set of content-type for responses to UTF-8 and > my first line of my doGet method is > response.setContentType("text/html;charset=UTF-8"); This will also have no effect. > My tomcat is started with CATALINA_OPTS=-Dfile.encoding=UTF-8 Okay. Let's see what your command-line program reports for file.encoding, etc. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkqyZxQACgkQ9CaO5/Lv0PArBACdGM53y+0/2L1lkf3gvngXpnAz 8D8An3pjgMT4jBOk6jg+zRNEXGORzJ1G =v9Bf -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org