UnicodeEncodeError when using os.listdir
Question:   * OS: Windows 7, 64-bit
  * Python 3.1.3

When I try to do this

    
    
    os.listdir("F:\\music")
    

I get this

    
    
    UnicodeEncodeError: 'gbk' codec can't encode character '\xe3' in position 643: illegal multibyte sequence
    

`os.listdir` works with other directories so the cause of the problem is
obviously some strangely-encoded file or folder within `F:\music` itself. How
do I find the source of this error?


Answer: It's a windows console unicode problem, you can fix it by install the [win-
unicode-console](https://github.com/Drekin/win-unicode-console) library

    
    
    $ pip install win-unicode-console
    $ edit a.py
    
      import win_unicode_console
    
      win_unicode_console.enable()
      print('non-gbk-character Résumé or 欧•亨利 works')
    

I've tested in python 3.4 in Chinese Windows 8

