python utf8日语

2024-10-16 22:28:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一些日语单词想转换成utf-8,如下所示:

jap_word1 = u'中山'
jap_word2 = u'小倉'

print jap_word1.encode('utf-8') # Doesn't work 
print jap_word2.encode('utf-8') # Prints properly

为什么一个单词可以正确地转换成utf-8并打印出来以显示相同的字符而不是另一个?

(我在Windows7Ultimate上使用Python2.6)


Tags: 字符单词printsutfencodeworkprintdoesn