Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running a Django site on a Debian 6 system, with a gunicorn server and nginx 0.7.67 handling static files. The filesystem locale is set to sv_SE.UTF-8.

I got a problem where another user uploaded a file with a filename containing unicode characters. This caused the server to throw a 404 when trying to serve the uploaded file. When I uploaded the same file from my system, the site now serves the file correctly. However, it didn't delete the old file, though they seem to be the exact same file in every regard. Below is the current directory listing.

-rwxr-xr-x 1 www-data www-data 1188260 25 jan 22.53 Läxa 15_geometri.pdf
-rwxr-xr-x 1 www-data www-data 1188260 27 jan 10.45 Läxa 15_geometri.pdf

How can there now be two identical files with the same (apparent) name? What can have been the cause of the 404 in the first place, i.e. what's wrong with the first upload? The URL is the same as before, only now it doesn't throw a 404.

share|improve this question

They have different encodings for filename. What is the output when you do in directory:

$ file -i *
share|improve this answer
    
Läxa 15_geometri.pdf: application/pdf; charset=binary Läxa 15_geometri.pdf: application/pdf; charset=binary – Samuel Linde Feb 1 '12 at 11:06

Visually the same unicode string may differ due to unicode normalization. You can check if names are different by trying to do ls > a.txt and analyzing file as binary data, byte by byte.

PS. I hope ls doesn't perform any unicode normalization itself and delivers filenames "as is"...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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