Extract files with invalid characters in filename with Python

后端 未结 3 1212
你的背包
你的背包 2021-01-06 03:50

I use python\'s zipfile module to extract a .zip archive (Let\'s take this file at http://img.dafont.com/dl/?f=akvaleir for example.)

f = zipfile.ZipFile(\'a         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-06 04:26

    I ran into a similar issue while running my application using Docker. Adding this lines to the Dockerfile, fixed everything for me:

    RUN locale-gen en_US.UTF-8
    ENV LANG en_US.UTF-8
    ENV LANGUAGE en_US:en
    ENV LC_ALL en_US.UTF-8
    

    So, I guess if you're not using Docker, give it a try and make sure locales are properly generated and set.

提交回复
热议问题