About this blog…

I am employed by Netnod as head of engineering, research and development and am among other things chair of the Security and Stability Advisory Committee at ICANN. You can find CV and photos of me at this page.

As I wear so many hats, I find it being necessary to somewhere express my personal view on things. This is the location where that happens. Postings on this blog, or at Facebook, Twitter etc, falls under this policy.

The views expressed on this post are mine and do not necessarily reflect the views of Netnod or any other of the organisations I have connections to.

Python and unicode is not always fun

Regardless of what programming language one use, there are always small irritating things that one have to keep track of. I have most certainly misunderstood something here, but wide unicode characters are not managed properly in Python 3.0.1 I think. Let me know what I have missed please.

$ python
Python 3.0.1 (r301:69597, Feb 14 2009, 19:03:52)
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> c = chr(0x10400)
>>> c
'��'
>>> print("%x" % ord(c))
10400
>>> for i in c:
...    print("%x" % ord(i))
...
d801
dc00
>>> type(c)
<class 'str'>

Comments are closed.