Open In App

Change Unicode to ASCII Character using Unihandecode

Last Updated : 08 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

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.

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.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads