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平仮平ÇÈÈ[email protected]È")
[email protected]
def acc(a):
outputString = unidecode.unidecode(a)
return outputString.upper()
acc("as平仮平ÇÈÈ[email protected]È")
ASPING JIA PING [email protected]
The output I am expecting for
acc("as平仮平ÇÈÈ[email protected]È")
is this
("AS平仮平[email protected]")
.