I am trying to convert filenames in russian zipfile to UTF-8 using convmv. Original filename: "æ óá¡¿½∞¡δ¼ áα«¼áΓ«¼.jpg" (æ\ óá¡¿½∞¡δ¼\ áα«¼áΓ«¼.jpg with slashes)

This analyzer (https://2cyr.com/decode/?lang=en) detected source encoding CP866 + displayed as CP437, and successfully decodes to desired С ванильным ароматом.jpg.

My question is, how can I set up convmv to decode it properly? For convmv -f cp866 -t utf-8 filename, I get "already UTF-8", in --nosmart mode I get jibberish.


A single pass of convmv can only fix one level of wrong-ness at a time. Your particular file is more complicated. It was originally cp866, and it was at some point turned into UTF-8, but whatever did that conversion thought it was originally cp437 and so converted it wrong. To fix this, you need to run convmv twice:

convmv -f utf-8 -t cp437 --notest 'æ óá¡¿½∞¡δ¼ áα«¼áΓ«¼.jpg'
convmv -f cp866 -t utf-8 --notest $'\x91 \xa2\xa0\xad\xa8\xab\xec\xad\xeb\xac \xa0\xe0\xae\xac\xa0\xe2\xae\xac.jpg'

Note that I had to escape the name in the second command. If you're running this in bulk and/or don't want to deal with doing that, you can use something like *.jpg, or put all of the affected files in their own directory and use the -r option to convmv.

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.