From owner-freebsd-questions@FreeBSD.ORG Tue May 24 07:32:21 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3939106566C for ; Tue, 24 May 2011 07:32:21 +0000 (UTC) (envelope-from f.bonnet@esiee.fr) Received: from hp9.esiee.fr (hp9.esiee.fr [147.215.1.4]) by mx1.freebsd.org (Postfix) with ESMTP id 436948FC14 for ; Tue, 24 May 2011 07:32:21 +0000 (UTC) Received: from mail.esiee.fr (mail.esiee.fr [147.215.1.3]) by hp9.esiee.fr (Postfix) with ESMTP id 1D84E14E94A7 for ; Tue, 24 May 2011 09:31:56 +0200 (CEST) X-DKIM: OpenDKIM Filter v2.3.2 hp9.esiee.fr 1D84E14E94A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=esiee.fr; s=MAILOUT; t=1306222316; bh=jzzSzR8bMetY9eC6MAum+bM7BnsO2mOnXOkW6THqkFI=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type; b=EDyE7LlyOvzjFhYjNBD/GiqQqt3zMWpY+uZmQNQzZbwD75/XZZAxq127KjLhyWTK+ xe4zshKMnpxf19RYq1f0mGhCE2lA4VD4vH9v+f/2/6R7TVwgVzZ1dRmgYE7az79/nu qSj8bFg42GCjiYYOO6VwLq+KmI8tANOw6Gw/x8T8= Received: from mail (localhost [127.0.0.1]) by VAMS.dummy (Postfix) with SMTP id 4260C105441F for ; Tue, 24 May 2011 09:32:20 +0200 (CEST) Received: from [147.215.1.21] (lisa.esiee.fr [147.215.1.21]) by mail.esiee.fr (Postfix) with ESMTP id 37F9B105441A for ; Tue, 24 May 2011 09:32:20 +0200 (CEST) Message-ID: <4DDB5F04.7030202@esiee.fr> Date: Tue, 24 May 2011 09:32:20 +0200 From: Frank Bonnet User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <990E8670-2137-4F80-8D9D-BCEB05C6ECAA@esiee.fr> <4DDB37BE.7080301@esiee.fr> In-Reply-To: <4DDB37BE.7080301@esiee.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: Filename containing French characters ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2011 07:32:21 -0000 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=20 /cv/ESIEE_MANAGEMENT/Systeme_information/11_EM2_SI_JUIN_CV_AMICHIA_Anthon= y%20Aim%C3%A9e%20Marthe%20Moteh.docx=20 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 =E9crit : >> Short answer, use a glob pattern. Assume I have a file named '=E0=20 >> fichier.txt': >> >> ls -l >> -rw-r--r-- 1 Modulok Modulok 12 May 23 09:01 ?? fichier.t= xt >> >> mv ?\ fichier.txt aFile.txt >> >> Long answer, for those who want to follow along and fix their=20 >> terminal to >> display UTF-8, keep reading... >> >> Step 1: Make a funky file to play along with this min-tutorial: >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> >> Create a text file with an editor that supports non-ASCII characters. = I >> created a file named 'filename' which containing this (no newline!): >> >> =E0 fichier.txt >> >> Step 2: Create the actual file with content >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> >> I used echo and cat like so in the tcsh shell: >> >> echo "hello world"> "`cat filename`" >> >> >> Step 3: Show the file in ls >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> >> As you can see below, the first character of the filename is=20 >> displayed as two >> question marks. This is the terminal's way of showing filenames that=20 >> it cannot >> display correctly. There are two question marks, because this is a=20 >> two-byte >> character. This does *not* mean the filename starts with a literal=20 >> question >> mark: >> >> >> -rw-r--r-- 1 Modulok Modulok 12 May 23 09:01 ?? fichier.t= xt >> >> Step 4: (optional) Fix the terminal >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> >> At this point, let's just fix the terminal so that UTF-8 characters ar= e >> displayed correctly. We want to see the French accented '=E0', and not= =20 >> a bunch of >> question marks. To do this, you edit '/etc/login.conf' as root. Add=20 >> two lines >> at the bottom of the 'default' section. My default section now looks=20 >> like this: >> >> >> default:\ >> :passwd_format=3Dmd5:\ >> :copyright=3D/etc/COPYRIGHT:\ >> >> ...and so on... >> >> :charset=3Den_US.UTF-8:\ >> :lang=3Den_US.UTF-8: >> >> If you're a French operation yours should probably look like this=20 >> instead: >> >> default:\ >> :passwd_format=3Dmd5:\ >> :copyright=3D/etc/COPYRIGHT:\ >> >> ...and so on... >> >> :charset=3Dfr_FR.UTF-8:\ >> :lang=3Dfr_FR.UTF-8: >> >> I'm not certain on these for all countries, but the above examples=20 >> work. We >> then need to rebuild the actual login database. Execute the following=20 >> command >> as root: >> >> cap_mkdb /etc/login.conf >> >> This generates /etc/login.conf.db from /etc/login.conf. Now log out=20 >> and then >> back in! >> >> >> Step 5: Back to the funky file >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D >> >> You should now see the actual accent characters correctly in the=20 >> terminal. >> (Assuming your terminal supports this): >> >> -rw-r--r-- 1 Modulok Modulok 12 May 23 09:01 =E0 fichier.= txt >> >> In some ternimals, we cannot type these characters. So you can access=20 >> the >> filename through a shell glob pattern. In most shells, the glob=20 >> pattern '?' >> matches any single character. The forward slash escapes the space in t= he >> filename. >> >> mv ?\ fichier.txt aFile.txt >> >> >> Hope this helps (and doesn't get too mangled.) >> -Modulok- > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to=20 > "freebsd-questions-unsubscribe@freebsd.org" --=20 Frank BONNET 01.45.92.66.17 Service des Moyens Informatiques Generaux ESIEE PARIS Cit=E9 Descartes / BP 99 93162 NOISY-LE-GRAND Cedex http://www.esiee.fr