Unicode support in Python 3
Last updated at 11:55 am UTC on 21 December 2015
From: https://docs.python.org/3/howto/unicode.html
Python code snippet
import unicodedata
u = chr(233) + chr(0x0bf2) + chr(3972) + chr(6000) + chr(13231)
for i, c in enumerate(u):
print(i, '%04x' % ord(c), unicodedata.category(c), end=" ")
print(unicodedata.name(c))
# Get numeric value of second character
print(unicodedata.numeric(u[1]))
gives
0 00e9 Ll LATIN SMALL LETTER E WITH ACUTE
1 0bf2 No TAMIL NUMBER ONE THOUSAND
2 0f84 Mn TIBETAN MARK HALANTA
3 1770 Lo TAGBANWA LETTER SA
4 33af So SQUARE RAD OVER S SQUARED
1000.0
Squeak
Something similar in Squeak...
u := 233 asCharacter asString,
16r0bf2 asCharacter asString,
3972 asCharacter asString,
6000 asCharacter asString,
13231 asCharacter asString.
1 to: u size do: [ :i | Transcript show: i printString; space;
show: ((u at: i) asInteger printStringRadix: 16);
cr ].
gives
1 16rE9
2 16rBF2
3 16rF84
4 16r1770
5 16r33AF