I have a UTF-8 character and I want to convert it into 16 bits of unicode encoding. How to do it?
Unicode of character can be obtained by reading the file where it is written and using repr() like:
import codecs
f = codecs.open("a.txt",mode='rb',encoding='utf-8')
r = f.readlines()
for i in r:
print i,repr(i)
Output:
پٹ u'\ufeff\u067e\u0679'
Now how can I get the 16 bits of unicode encoding for u'\ufeff\u067e\u0679'
?