Walter Dörwald wrote:
Walter Dörwald wrote:
Hans-Jörg Bibiko wrote:
On 02.06.2008, at 00:04, Walter Dörwald wrote:
Here's another patch (against the current version). It shows both the codepoint and the name. [...]
Here's another suggestions on the current Bundle version:
To get the UTF-8 bytes of a character, you're doing the following:
print " UTF-8 : " + "
".join(repr(char.encode("UTF-8")).split('\x')).lstrip("' ").rstrip("'").upper()
This only works for characters with a codepoint >= 128. The following code should work better:
print " UTF-8 : %s" % " ".join(hex(ord(c))[2:].upper() for
c in char)
Oops, that was of course supposed to be:
print " UTF-8 : %s" % " ".join(hex(ord(c))[2:].upper() for c in char.encode("utf-8"))
Servus, Walter