tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Create FileInputStream in servlet from remote file with accentuated character name
Date Tue, 22 Sep 2009 01:51:49 GMT
Hash: SHA1


On 9/21/2009 5:45 AM, André Warnier wrote:
> Sylvie Perrin wrote:
>> Christopher,
>> Here is the stack trace of the FileNotFoundException:
>> /home/me/mountDir/fichi��.txt (No such
>> file or directory)


> Assuming that what I see above is also what you see in the logfile
> ("fichi" + 2 strange characters + ".txt") :


What is the source of that file name? Is it hard-coded into your Java
code? If so, how? Did you just type "fichié.txt" into your .java file,
or did you use "\uxyz" syntax to specify the UNICODE character you intended?

If you are reading the filename from a remote client, then all the
request URI encodings and all that stuff are definitely relevant (ion
spite of my previous statements to the contrary).

Can you post your servlet code?

> Furthermore :
> The file is really located on a Windows server.
> The Windows directory where the file is located, is "mounted" through
> the CIFS filesystem, onto a local mountpoint on your (Linux) Java and
> Tomcat host.
> On your Java/Tomcat host, Java is seeing the contents of this directory
> *through* this CIFS filesystem mount.
> In principle (but that is only an assumption here), the CIFS filesystem
> code (running on the localhost) shows this (remote) directory content to
> a local application "as is", without making any character set translation.

Honestly, I think the above should not be a problem. I am the semi-proud
owner of the soundtrack to the film "π" (that's "pi" to those whose
email agents don't understand UTF-8 encoding). I used to have all my
albums in MP3 (or Ogg Vorbis) format on an ext3 partition shared using
Samba over a network to a Windows machine. The directory was created by
Windows over the network, and the directory name always showed correctly
in Windows. On my server, however, xterm and/or ls always showed it as
some unrecognizable garbage characters. But Windows consistently showed
it correctly.

I suppose that doesn't really prove anything, but it's probably worth

Furthermore, the OP is capable of opening said file with a non-servlet
Java example program, so it's not a
Java/ problem.

I suspect your servlet is either misinterpreting the file name from a
remote client (most likely) or you have done something like use a
non-standard encoding for your .java files. The answers to the above
questions will definitely help.

- -chris
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message