As you answered in the comment, the TEXT is already escaped. Change the function that generate the TEXT
to correctly return a string.
If you can't control the function that generate the text, unescape the text using str.decode
with unicode_escape
encoding.
>>> TEXT = u'word=\\u0631\\u064e\\u062c\\u0627'
>>> print TEXT
word=\u0631\u064e\u062c\u0627
>>> TEXT = TEXT.decode('unicode-escape')
>>> print TEXT
word=رَجا
Example
# coding: utf-8
from Tkinter import *
root = Tk()
text = Text(root)
text.pack()
QUERY = u'\u0627\u0631\u062c\u0648'
TEXT = u'word=\\u0631\\u064e\\u062c\\u0627' # escaped!!
TEXT = TEXT.decode('unicode-escape')
word = re.findall(u'word=.*', TEXT, re.UNICODE)[0]
header = " ".join([QUERY, word])
text.insert('1.0', "".join([header,'\n']))
root.mainloop()