title: Python - how to convert unicode filename to CP437?
body: <p>I have a file that has a Unicode name, say <code>'קובץ.txt'</code>. I want to pack him, and I'm using python's <a href="https://docs.python.org/2/library/zipfile.html" rel="nofollow">zipfile</a>.</p>
  
  <p>I can zip the files and open them later on with a problem except that file names are messed up when using windows 7 file explorer to view the files (7zip works great).</p>
  
  <p>According to the docs, this is a common problem, and there are instructions on how to deal with that:</p>
  
  <blockquote>
    <p>From ZipFile.write</p>
    
    <p><strong>Note</strong></p>
    
    <p>There is no official file name encoding for ZIP files. If you have
    unicode file names, <strong>you must convert them to byte strings in your
    desired encoding</strong> before passing them to write(). WinZip interprets all
    file names as encoded in CP437, also known as DOS Latin.</p>
  </blockquote>
  
  <p>Sorry, but I can't seem to get what exactly am I supposed to do with the filename. I've tried <code>.encode('CP437')</code>, <code>.decode('CP437')</code>..</p>