2

Recently I moved to a new server after the old one had died. I had wordpress installation there, powered by Apache2 and Gentoo Linux. When moving, I decided to use nginx and Debian instead. I brought my wordpress back to work and everything would be fine if not for one little...

Problem

Images that contain special characters in the filenames don't load, I get 404 Not Found. For instance when requesting

http://my_site/wp-content/uploads/2013/05/Zajęcia-dla-dorosłych-z-bollywood-dance.jpg

wordpress responds

You tried going to http://my_site/wp-content/uploads/2013/05/Zaj%C4%99cia-dla-doros%C5%82ych-z-bollywood-dance.jpg, and it doesn't exist.

I played a while with the terminal and discovered that image filenames on the server differ a little bit from those requested by the wordpress. Despite they look identically, special character sequences are encoded in a different way. For example, when I copy filename Zajęcia-dla-dorosłych-z-bollywood-dance.jpg from terminal it is encoded as Zajęcia-dla-dorosłych-z-bollywood-dance.jpg. On the other hand, wordpress is looking for file Zajęcia-dla-dorosłych-z-bollywood-dance.jpg which doesn't exist, of course.

Both systems (the old Gentoo and the current Debian) are set to use UTF-8-based locale.

How to solve?

I think about three possible reasons:

  • Debian stores special characters in filenames differently than Gentoo
  • my new mysql stores special characters differently than the old one
  • nginx handles special characters differently than Apache

Any suggestions how to falsificate those hypothesis and, finally, solve the problem?

1 Answer 1

1

Ok, I solved the problem by correcting the filenames with a script. I think the encoding of special characters was broken at some point when I was copying the files between systems (Gentoo => Mac OS X => Debian). Feel free to use and edit my script it you have similar problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .