1

My images whose names contain accented letters (é, à etc.) are not accessible via Apache (404 error).

I think it's not related to Apache. I checked the configuration file:

AddDefaultCharset UTF-8

When I connect via Putty, and run the command "ls -la" to list the images, the accented letters are replaced with "?" in the console.

Here's the relevant info that may help:

> echo $LANG
en_US.UTF-8
> cat /etc/environment
empty file
> locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

I found some tutorials, but they are applicable to Centos 5/6.

PS: Renaming files is a possible solution, but not envisageable in my case.

  • Have you tried renaming the files so that they have the correct names? – Michael Hampton Jan 28 '16 at 17:06
  • I want to keep accented letters in filenames, it will be quick because I am working on a French environment. Renaming files will technically fix the issue but it's somewhat nasty. – AFA Med Jan 28 '16 at 17:47
1

First @Simohammedhttc: You are using correct names! Please do not resort to renaming files. It is the year 2016. We have all the technology available so that nobody has to castrate some filenames just because the names are not English.

The locale settings look fine. The fact that putty has a problem displaying non-ASCII characters (i.e. showing ? instead) might be totally putty's problem. Not using putty these days but I recall playing with the putty settings to get it right.

I just checked that my current CentOS 7 will happily serve this umlaut URL via Apache2:

http://<server>/äöü.txt

The text file contains again the same umlauts. Browser (Safari) says that the encoding is UTF-8. Putting this in some HTML also works:

  • <a href="äöü.txt">äöü.txt</a></td>
  • of course this also: <a href="%c3%a4%c3%b6%c3%bc.txt">äöü.txt</a>

Please try if the images can be accessed directly by pasting the image URL into the address bar of the browser.

If that works please check how the links to the images are generated. Take a look at the source:

  • Verify that the browser recognizes everything as UTF-8.
  • Verify that the image URLs are not mangled by any intermediate processing.
  • +1 for url_encoded characters, however I don't want to dive into code, it's a purely system related issue – AFA Med Jan 29 '16 at 14:04
1

Finally I resolved the issue
I installed convmv and executed the following command on the folder of images:

// -r => recursively
// --notest => don't show me the potential outcome, do convert filenames
// -f => from
// -t => to
convmv -r --notest -f iso-8859-15 -t utf8 images_folder

This issue is related to files that was created in Windows environment, then uploaded to Centos server.

I created a file directly in Centos with accented letters in its filename and it was listed without any problem in Putty.

cd images_folder
touch étude.png
ls -la // file étude.png listed without any problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.