R
rajasekaran.natarajan
Hi friends,
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 unicodeEncodeError when I try with the Japanese letter.
I tried to decode it by but I am getting unicodeEncodeError.
the snippet is given below
class showex:
....
.......
def make gui
.....
....
self.entStr = StringVar()
self.entStr.set('Enter a Word Here')
wordEntry = Entry(self.msgFrame,textvariable=self.entStr)
#wordEntry.insert(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('sjis')
print "Inside search ...", word_utf.encode('utf8')
I tried
調ã¹ã‚‹ #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
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 unicodeEncodeError when I try with the Japanese letter.
I tried to decode it by but I am getting unicodeEncodeError.
the snippet is given below
class showex:
....
.......
def make gui
.....
....
self.entStr = StringVar()
self.entStr.set('Enter a Word Here')
wordEntry = Entry(self.msgFrame,textvariable=self.entStr)
#wordEntry.insert(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('sjis')
print "Inside search ...", word_utf.encode('utf8')
I tried
調ã¹ã‚‹ #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