tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Create FileInputStream in servlet from remote file with accentuated character name
Date Mon, 21 Sep 2009 19:16:26 GMT
Sylvie Perrin wrote:
> André,
> Thank you for your help but I can't follow your main recommendation, ie. 
> avoid using non US-ASCII names.
> Actually, file names are part of information my servlet have to process 
> and they cannot be changed.
> I am not the "owner" of these names and I must deal with them.
Ok, then : who is creating those files inside the Windows directory, and 
how do they create them ? (using which tool ?).
This is important, to figure out if the process(es) creating these files 
are consistent, and if you can always expect a specific character 
encoding scheme for those file names.

Let me give you an example, as a tutorial :
- with Windows Explorer :
   - inside your shared directory, create a test sub-directory
   - in this directory, use the right mouse click to create a new text 
document. Name it, for example, "fichié.txt". Notice that you did this, 
from your workstation, using your keyboard, and under Windows Explorer. 
  The file in the directory looks like it has the name "fichié.txt", right ?
- now on that same server, you will need a console window, to open a 
Windows Command Window (the black "DOS window").  In that command 
window, use "cd" to navigate to your test directory. When you are there, 
enter "dir" and look at the file list.  How does your file name look like ?
- in the same command window, create a new file by using this command :
echo "Hello André" > fichié-deux.txt
- do a dir. How does that one look like ?
- then go back to Explorer and compare the two filenames. Do they look 
the same ? (as far as the "é" s are concerned)
- now go back to your Tomcat host, and using "cd", navigate to your 
Windows test directory (should be /mnt/....).
- use the same command
echo "Hello André" > fichié-trois.txt
to create a file (from linux) on the Windows server.  Do an "ls -l" to 
see what it looks like from Linux.

Then again, compare the names in (1) the Windows Explorer, (2) the DOS 
command window and (3) your Linux window.  Is everything still consistent ?
If not (you see different names depending on the interface), make a 
table showing what the filenames look like in the 3 cases.
Also, under Linux, enter the command "locale" and note the result.

The above is the first step, and concerns only the filenames.  Next, you 
should have a look at file contents, and check if accented text words in 
the contents also look consistent or not.

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

View raw message