Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Change Unicode to ASCII Character using Unihandecode

  • Last Updated : 12 Nov, 2020

Unicode is generally represented as “\u4EB0\U5317” but this is nearly useless to a user who actually wants to read the real stuff what the text says. So in this article, we will see how to convert Unicode to ASCII Character using the Unihandecode module.

What is Unihandecode?

Unihandecode provide a function ” decode (……) ” that takes Unicode data as input and tries to represent it in ASCII Character. In simple language we can say that it is a transliteration to convert all character in Unicode to ASCII alphabet.

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

List of decoders



  •  ‘ja’: Japanese Kanji, Hiragana, and Katakana.
  •  ‘zh’: Chinese Kanji 
  •  ‘kr’: Korean Character
  •  ‘vn’: Vietnamese Character

Installation

This module does not come built-in with Python. To install this type the below command in the terminal.

pip install unihandecode 

Example:

Python3




from unihandecode import Unihandecoder
  
data1 = Unihandecoder(lang='zh')
print(data1.decode("\u660e\u5929\u7684\u98ce\u5439"))

Output: 

Ming Tian De Feng Chui

The first line argument takes the name of the decoder you want to use. Then the decoder takes a string as argument an returns the transliterated string.

My Personal Notes arrow_drop_up
Recommended Articles
Page :