I am writing my Japanese study program and a GUIt.
I am facing a problem in an entry widget where I enter Japanese words.
The entered Japanese word is accessed by the callback function and used
for some processes.
It is working well when I enter english values.
But giving unicodeEncodeEr ror when I try with the Japanese letter.
I tried to decode it by but I am getting unicodeEncodeEr ror.
the snippet is given below
class showex:
....
.......
def make gui
.....
....
self.entStr = StringVar()
self.entStr.set ('Enter a Word Here')
wordEntry = Entry(self.msgF rame,textvariab le=self.entStr)
#wordEntry.inse rt(0, 'Enter word Here')
wordEntry.pack( side=RIGHT)
wordEntry.focus ()
wordEntry.bind( '<Return>',self .search)
def previous(self):
if (self.inc > 9):
self.inc = self.inc -5
print 'Previous Executed', self.inc
def next(self):
self.inc = self.inc + 5
print 'Next Executed', self.inc
def search(self):
word = self.entStr.get ()
word_utf = word.decode('sj is')
print "Inside search ...", word_utf.encode ('utf8')
I tried
word = '調べる' #some Japanese word in the quotes
word1 = word.decode('sj is')
print word1.encode('u tf8')
調べる #printed the Japanese word correctly
this is working nicely
What am I doing wrong here
I would greatly appreciate any help or suggestion.
Regards
raj