UNew to Tkinter nicodeEncodeError:Japanese

Fredrik Lundh fredrik at pythonware.com
Thu Dec 22 11:41:57 CET 2005


rajasekaran.natarajan at gmail.com wrote:

> It is working well when I enter english values.
> But giving unicodeEncodeError when I try with the Japanese letter.
>
> I tried to decode it by but I am getting unicodeEncodeError.

chances are that Tkinter has already decoded the string for you.

>    def search(self):
>        word = self.entStr.get()
>        word_utf = word.decode('sjis')
>        print "Inside search ...", word_utf.encode('utf8')

try replacing this with

    def search(self):
        word = self.entStr.get()
        print repr(word)
        print "Inside search ...", word.encode('utf8')

and let us know what it prints.

</F> 






More information about the Python-list mailing list