Home  >  Q&A  >  body text

字符编码 - python的tkinter的Text组件中文本编码的问题

首先我不知道这个算不算是字符编码问题..
是这样,我用tkinter的text组件画了一个文本框,在切换到搜狗输入法的时候,按backspace键来删除,发生了很奇怪的情况,如图所示:

就是按一下backspace,就会变成一个类似“口”的符号,之后再按backspace就不无法删除了,然后关掉搜狗输入法,按backspace又能够正常删除了,这是什么原因呢?

PHP中文网PHP中文网2742 days ago945

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-17 15:06:03

    Add # -- coding: utf-8 -- to the header of each python file to indicate that the python interpreter uses UTF-8 encoding for the character processing set in this file.
    When you input Chinese characters, make sure your Sogou input method is not in full-width mode. The Chinese character set should be set to half-width mode

    reply
    0
  • 黄舟

    黄舟2017-04-17 15:06:03

    There is no way around it. It works in XP or Win7. This phenomenon also occurs when I use Win8.

    reply
    0
  • Cancelreply