[TxMt] New "Unicode" bundle in the Review trunk
Hans-Joerg Bibiko
bibiko at eva.mpg.de
Tue Jun 3 15:36:35 UTC 2008
On 3 Jun 2008, at 17:29, Walter Dörwald wrote:
> 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"))
Once again, thanks a lot for teaching me Python ;)
The code changes are in the SVN trunk.
--Hans
More information about the textmate
mailing list