Filename containing French characters ?

Frank Bonnet f.bonnet at esiee.fr
Tue May 24 07:32:21 UTC 2011


OK now the filenames are well displayed in the console
\BUT ...

It still does not work with apache ( 404 file not found ! )

here is the log of apache when trying to access a filename
that contains those bloody characters



82.238.8.126 - - [24/May/2011:06:56:01 +0200] "GET 
/cv/ESIEE_MANAGEMENT/Systeme_information/11_EM2_SI_JUIN_CV_AMICHIA_Anthony%20Aim%C3%A9e%20Marthe%20Moteh.docx 
HTTP/1.1" 404 1337

The problem comes from the %C3%A9e character ( e eacute )

apache is unable to open that filename


On 05/24/2011 06:44 AM, Frank Bonnet wrote:
> Thanks that is working :-)
>
> Now I have to test the application ( apache based application )
> to see if it is able to open the file.
>
> I'll tell in few hours when arrived to my office
>
>
> Le 23/05/2011 17:50, Modulok a écrit :
>> Short answer, use a glob pattern. Assume I have a file named 'à 
>> fichier.txt':
>>
>>      ls -l
>>      -rw-r--r--  1 Modulok  Modulok       12 May 23 09:01 ?? fichier.txt
>>
>>      mv ?\ fichier.txt aFile.txt
>>
>> Long answer, for those who want to follow along and fix their 
>> terminal to
>> display UTF-8, keep reading...
>>
>> Step 1: Make a funky file to play along with this min-tutorial:
>> ===============================================================
>>
>> Create a text file with an editor that supports non-ASCII characters. I
>> created a file named 'filename' which containing this (no newline!):
>>
>>          à fichier.txt
>>
>> Step 2: Create the actual file with content
>> ===========================================
>>
>> I used echo and cat like so in the tcsh shell:
>>
>>          echo "hello world">  "`cat filename`"
>>
>>
>> Step 3: Show the file in ls
>> ===========================
>>
>> As you can see below, the first character of the filename is 
>> displayed as two
>> question marks. This is the terminal's way of showing filenames that 
>> it cannot
>> display correctly. There are two question marks, because this is a 
>> two-byte
>> character. This does *not* mean the filename starts with a literal 
>> question
>> mark:
>>
>>
>>      -rw-r--r--  1 Modulok  Modulok       12 May 23 09:01 ?? fichier.txt
>>
>> Step 4: (optional) Fix the terminal
>> ===================================
>>
>> At this point, let's just fix the terminal so that UTF-8 characters are
>> displayed correctly. We want to see the French accented 'à', and not 
>> a bunch of
>> question marks. To do this, you edit '/etc/login.conf' as root. Add 
>> two lines
>> at the bottom of the 'default' section. My default section now looks 
>> like this:
>>
>>
>>      default:\
>>              :passwd_format=md5:\
>>              :copyright=/etc/COPYRIGHT:\
>>
>>              ...and so on...
>>
>>              :charset=en_US.UTF-8:\
>>              :lang=en_US.UTF-8:
>>
>> If you're a French operation yours should probably look like this 
>> instead:
>>
>>      default:\
>>              :passwd_format=md5:\
>>              :copyright=/etc/COPYRIGHT:\
>>
>>              ...and so on...
>>
>>              :charset=fr_FR.UTF-8:\
>>              :lang=fr_FR.UTF-8:
>>
>> I'm not certain on these for all countries, but the above examples 
>> work. We
>> then need to rebuild the actual login database. Execute the following 
>> command
>> as root:
>>
>>      cap_mkdb /etc/login.conf
>>
>> This generates /etc/login.conf.db from /etc/login.conf. Now log out 
>> and then
>> back in!
>>
>>
>> Step 5: Back to the funky file
>> ==============================
>>
>> You should now see the actual accent characters correctly in the 
>> terminal.
>> (Assuming your terminal supports this):
>>
>>      -rw-r--r--  1 Modulok  Modulok       12 May 23 09:01 à fichier.txt
>>
>> In some ternimals, we cannot type these characters. So you can access 
>> the
>> filename through a shell glob pattern. In most shells, the glob 
>> pattern '?'
>> matches any single character. The forward slash escapes the space in the
>> filename.
>>
>>      mv ?\ fichier.txt aFile.txt
>>
>>
>> Hope this helps (and doesn't get too mangled.)
>> -Modulok-
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to 
> "freebsd-questions-unsubscribe at freebsd.org"


-- 

Frank BONNET

01.45.92.66.17

Service des Moyens Informatiques Generaux

ESIEE PARIS
Cité Descartes / BP 99
93162 NOISY-LE-GRAND Cedex
http://www.esiee.fr <http://www.esiee.fr/>



More information about the freebsd-questions mailing list