title: How to workaround Python "WindowsError messages are not properly encoded" problem?
body: <p>It's a trouble when Python raised a WindowsError, the encoding of message of the exception is always os-native-encoded.  For example:</p>
  
  <pre><code>import os
  os.remove('does_not_exist.file')
  </code></pre>
  
  <p>Well, here we get an exception:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  WindowsError: [Error 2] 系統找不到指定的檔案。: 'does_not_exist.file'
  </code></pre>
  
  <p>As the language of my Windows7 is Traditional Chinese, the default error message I get is in big5 encoding (as know as CP950).</p>
  
  <pre><code>&gt;&gt;&gt; try:
  ...     os.remove('abc.file')
  ... except WindowsError, value:
  ...     print value.args
  ...
  (2, '\xa8t\xb2\xce\xa7\xe4\xa4\xa3\xa8\xec\xab\xfc\xa9w\xaa\xba\xc0\xc9\xae\xd7\xa1C')
  &gt;&gt;&gt;
  </code></pre>
  
  <p>As you see here, error message is not Unicode, then I will get another encoding exception when I try to print it out.  Here is the issue, it can be found in Python issue list:
  <a href="http://bugs.python.org/issue1754" rel="nofollow noreferrer">http://bugs.python.org/issue1754</a></p>
  
  <p>The question is, how to workaround this?  How to get the native encoding of WindowsError?
  The version of Python I use is 2.6.</p>
  
  <p>Thanks.</p>