擅长:python、mysql、java
<p>你需要知道字节串的编码。它看起来像<code>windows-1252</code>:</p>
<pre><code>x = u'Ko\u0161ick\xfd'
y = 'Ko\x9aick\xfd'
print x == y.decode('windows-1252')
print x.encode('windows-1252') == y
</code></pre>
<p>输出:</p>
^{pr2}$
<p>最佳实践是在输入到程序时将文本转换为Unicode,用Unicode进行所有处理,并将其转换回编码字节以持久存储,在套接字上传输等</p>