How to Encode String of Raw UTF-8 into Unicode?

Henry Chang goldspin at gmail.com
Thu Mar 6 19:43:58 EST 2008


Hi everyone,

Suppose I start out with a raw string of utf-8 code points.

  raw_string = "68656E727963"

I can coerce it into proper unicode format by slicing out two
characters at a time.

  unicode_string = u"\x68\x65\x6E\x72\x79\x63"

  >>>  print unicode_proper
  >>> henry

My question: is there an existing function that can do this (without
having to manually slicing the raw text string)?

Thanks.



More information about the Python-list mailing list