Converting complex characters
The ability to access the entire Unicode character set opens up many new possibilities for rendering complex characters, especially characters in alphabets other than Latin-1.
How to do it...
Some languages are read right-to-left instead of left-to-right. Examples include Hebrew and Arabic. In this example, we show you how to present reverse text using the
U+202E
Unicode character for right-to-left override. The following line of code printstxet desreveR
:echo "\u{202E}Reversed text"; echo "\u{202D}"; // returns output to left-to-right
Note
Don't forget to invoke the left-to-right override character,
U+202D
, when finished!Another consideration is the use of composed characters. One such example is
ñ
(the lettern
with a tilde~
floating above). This is used in words such as mañana (the Spanish word for morning or tomorrow, depending on the context). There is a composed character available, represented by Unicode codeU+00F1
. Here is an example of its use, which...