How to convert fancy/artistic unicode text to ASCII?

Viewed 631

I have a unicode string like " " and would like to convert it to the ASCII form "thug life".

I know I can achieve this in Python by

import unidecode
print(unidecode.unidecode(' '))
// thug life

However, this would asciify also other unicode characters (such as Chinese/Japanese characters, emojis, accented characters, etc.), which I want to preserve.

Is there a way to detect these type of "artistic" unicode characters?

Some more examples:

thug life

Thanks for your help!

1 Answers
import unicodedata
strings = [
  ' ',
  ' ',
  ' ',
  ' ',
  'thug life']
for x in strings:
  print(unicodedata.normalize( 'NFKC', x), x)

Output: .\62803325.py

thug life  
thug life  
thug life  
thug life  
thug life thug life

Resources:

Related