Python Unicodedata Library
This module provides access to the Unicode Character Database (UCD) which defines character properties for all the characters present in the Unicode Database.
The next two functions defined here are:
1. unicodedata.east_asian_width(chr)
2. unicodedata.mirrored(chr)
unicodedata.east_asian_width(chr):
This is a function in the unicodedata library in python which returns the East-Asian-Width assigned to the character 'chr' given as the argument to the function.
The return value is in the form of a string which represents the width aspects.
In context of interoperating with the East Asian Legacy character encodings and implementing East Asian Typography, the East Asian width is a characterization of character and it can take two values 'Narrow' and 'Wide'.
unicode.mirrored(chr):
Mirroring is the property of the characters, such as parenthesis, whose images are reflected horizontally in text that is laid out right-to-left.
The mirrored property is important to ensure that the correct characters are used for the desired semantic. This is of particular importance where the name of the character does not indicate the intended semantic.
For example "(" character, while the name indicates that it is a left parenthesis, the character really expresses an open parenthesis—the leading character in a parenthetical phrase, not the trailing one.
This function returns the mirrored property assigned to the character 'chr' as integer. It returns 1 if the character has been identified as a 'mirrored' character in bidirectional text, and 0 otherwise.
Comments