0

I designed an Interface in Python Which I want to use as a project relating to Natural Language Processing. But When ever I try to write any Bangla Language word in the Input Field It shows Question Mark "????", How can I fix it?

Here is the Interface Code:

from tkinter import *

def show_entry_fields():

#This Line is Printing The Scanned String
   print("First Sentence: %s\nSecond Sentence: %s\nThird Sentence: %s" % (e1.get(), e2.get(),e3.get()))


#Below This Line Is Interface Coding I think
   e1.delete(0,END)
   e2.delete(0,END)
   e3.delete(0,END)

master = Tk()
Label(master, text="First Sentence").grid(row=0)
Label(master, text="Second Sentence ").grid(row=1)
Label(master, text="Third Sentence").grid(row=2)

e1 = Entry(master)
e2 = Entry(master)
e3 = Entry(master)


e1.insert(20,"")
e2.insert(20,"")
e3.insert(20,"")


e1.grid(row=0, column=1, columnspan=2)
e2.grid(row=1, column=1, columnspan=2)
e3.grid(row=2, column=1, columnspan=2)


Button(master, text='Quit', command=master.quit).grid(row=5, column=0, sticky=W, pady=4)
Button(master, text='Show Similar Word', command=show_entry_fields).grid(row=5, column=1, sticky=W, pady=4)

mainloop( )

Screen Shots: Image 1 Image 2

In image 1 English working Properly but when I start to use bangla in image 2, it prints "????" question marks.Both the Interface and Shell Prints same "????" question mark.I researched a bit and I think the solution Lies in "utf-8" encoding but I can't implement it in this interface.

  • Are you using a font that supports the glyphs you're trying to display? Tkinter has very robot unicode support. – Bryan Oakley Oct 17 '17 at 03:59
  • It's Bengali font and I was trying to print normal Bengali letters. But in tkinter GUI nothing is showing up except "?????". I tried this solution:https://stackoverflow.com/questions/30169541/accessing-bangla-utf-8-string-by-index-in-python but nothing happened. – Kazi Miftahul Hoque Oct 18 '17 at 05:41
  • I don't see anywhere in the code wher eyou set the font to a Bengali font. – Bryan Oakley Oct 18 '17 at 11:47

1 Answers1

0

I fixed the Issue using a different Library of Python which supports the utf-8 encoding.

It's PyQt. previously I was using tkinter and it was showing ??? as there was no support for utf-8 in tkinter library.