擅长:python、mysql、java
<p>您可能想尝试将环境变量“pythonionecoding”更改为“utf_8”。我写了一篇<a href="http://daveagp.wordpress.com/2010/10/26/what-a-character/" rel="noreferrer">page on my ordeal with this problem</a>。</p>
<p>博客作者:</p>
<pre class="lang-python prettyprint-override"><code>import sys, locale, os
print(sys.stdout.encoding)
print(sys.stdout.isatty())
print(locale.getpreferredencoding())
print(sys.getfilesystemencoding())
print(os.environ["PYTHONIOENCODING"])
print(chr(246), chr(9786), chr(9787))
</code></pre>
<p>给你</p>
<pre class="lang-none prettyprint-override"><code>utf_8
False
ANSI_X3.4-1968
ascii
utf_8
ö ☺ ☻
</code></pre>