What I want is to convert accented characters into english and if there is some other language present then it should give blank.I have tried certain codes like below but its converting even the other langagues to english below or removing them.What should I do?
def check1(email):
try:
email = unicode(email, 'utf-8')
except (TypeError, NameError): # unicode is a default on python 3
pass
email = unicodedata.normalize('NFD', email)
email = email.encode('ascii', 'ignore')
email = email.decode("utf-8")
return email.upper()
check1("as平仮平ÇÈÈ.a@yah.comÈ")
ASCEE.A@YAH.COME
def acc(a):
outputString = unidecode.unidecode(a)
return outputString.upper()
acc("as平仮平ÇÈÈ.a@yah.comÈ")
ASPING JIA PING CEE.A@YAH.COME
The output I am expecting for
acc("as平仮平ÇÈÈ.a@yah.comÈ")
is this
("AS平仮平CEE.A@YAH.COME")
.