Forked from buaahsh/gist:3052108d3a41d1244eceee046458323f
Last active
August 10, 2021 06:04
-
-
Save aashutoshrathi/9bf2e3dd86868624328ed71ca4a904b8 to your computer and use it in GitHub Desktop.
UNICODE to ASCII JS Replace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def unicodetoascii(text): | |
TEXT = (text. | |
replace('\\xe2\\x80\\x99', "'"). | |
replace('\\xc3\\xa9', 'e'). | |
replace('\\xe2\\x80\\x90', '-'). | |
replace('\\xe2\\x80\\x91', '-'). | |
replace('\\xe2\\x80\\x92', '-'). | |
replace('\\xe2\\x80\\x93', '-'). | |
replace('\\xe2\\x80\\x94', '-'). | |
replace('\\xe2\\x80\\x94', '-'). | |
replace('\\xe2\\x80\\x98', "'"). | |
replace('\\xe2\\x80\\x9a', ","). | |
replace('\\xe2\\x80\\x9b', "'"). | |
replace('\\xe2\\x80\\x9c', '"'). | |
replace('\\xe2\\x80\\x9c', '"'). | |
replace('\\xe2\\x80\\x9d', '"'). | |
replace('\\xe2\\x80\\x9e', '"'). | |
replace('\\xe2\\x80\\x9f', '"'). | |
replace('\\xe2\\x80\\xa6', '...').# | |
replace('\\xe2\\x80\\xb2', "'"). | |
replace('\\xe2\\x80\\xb3', "'"). | |
replace('\\xe2\\x80\\xb4', "'"). | |
replace('\\xe2\\x80\\xb5', "'"). | |
replace('\\xe2\\x80\\xb6', "'"). | |
replace('\\xe2\\x80\\xb7', "'"). | |
replace('\\xe2\\x81\\xba', "+"). | |
replace('\\xe2\\x81\\xbb', "-"). | |
replace('\\xe2\\x81\\xbc', "="). | |
replace('\\xe2\\x81\\xbd', "("). | |
replace('\\xe2\\x81\\xbe', ")") | |
) | |
return TEXT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment