I moved my website from one server to another and encounter a problem with cyrillic filenames. Some cyrillic URLs in wordpress are fine and some are now broken. It used to be OK on previous server.

Here's what it looks like: in wordpress images library I see an image broken, with URL: /wp-content/uploads/2013/11/олимпийские-новогодние-шары.jpg (URL-encoded version: /wp-content/uploads/2013/11/%D0%BE%D0%BB%D0%B8%D0%BC%D0%BF%D0%B8%D0%B9%D1%81%D0%BA%D0%B8%D0%B5-%D0%BD%D0%BE%D0%B2%D0%BE%D0%B3%D0%BE%D0%B4%D0%BD%D0%B8%D0%B5-%D1%88%D0%B0%D1%80%D1%8B.jpg )

I navigate to this URL and see 404 error.

Then I go to FTP, copy filename from there (олимпийские-новогодние-шары.jpg) and navigate to URL /wp-content/uploads/2013/11/олимпийские-новогодние-шары.jpg

(URL-encoded version: /wp-content/uploads/2013/11/%D0%BE%D0%BB%D0%B8%D0%BC%D0%BF%D0%B8%D0%B8%CC%86%D1%81%D0%BA%D0%B8%D0%B5-%D0%BD%D0%BE%D0%B2%D0%BE%D0%B3%D0%BE%D0%B4%D0%BD%D0%B8%D0%B5-%D1%88%D0%B0%D1%80%D1%8B.jpg )

Now it works!

Once again:

  • олимпийские-новогодние-шары.jpg - broken
  • олимпийские-новогодние-шары.jpg - works.

It looks absolutely the same. Copy and paste URL above to check!

If I take a URL with working filename (copied from FTP or SSH) and replace Cyrillic filename from keyboard letter by letter, it goes fine (200 OK) until I change й (copied from FTP) to й - typed from keyboard/copied from wordpress.

It absolutely blows my mind! The same looking letter works in one case and doesn't in the other. And why й and not another Cyrillic letter, like ш or д? Substitution of these letters (in filename copied from FTP) from keyboard doesn't produce the 404 error.

If we look closer, URL-encoded versions are not quite the same:


But why and how can I influence it?

  • This might have something to do with the web-browser guessing the wrong encoding for URL. AFAIK; if you offer your website using UTF-8 (which IMHO should be the default nowadays) then all URLs should be encoded this way as well.
    – phk
    Nov 8, 2015 at 10:39
  • Are you sure this is UNIX/Linux-specific though?
    – phk
    Nov 8, 2015 at 10:39
  • Yes, it should be utf-8 all around. The website I'm talking about is www.skoroprazdnik.ru. The question is not 100% Linux-specific, but it's a nginx webserver running on Linux. Nov 8, 2015 at 10:53
  • I can move this question to another place if there's a better place to ask about it. Nov 8, 2015 at 12:08
  • 3
    й (broken) is U+0439 CYRILLIC SMALL LETTER SHORT I. й (working) is U+0438 CYRILLIC SMALL LETTER I followed by U+0306 COMBINING BREVE. They are different strings representing the same text as far as humans are considered. It seems that some part of your system is attempting to canonicalize the representation of file names, but that fails because another part requires string equality, not just equivalence. I have no idea how to identify the misbehaving part, this would benefit from Wordpress expertise so your question might be better off on WordPress Development (even though it's on-topic here). Nov 8, 2015 at 18:06


Your Answer

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

Browse other questions tagged or ask your own question.