3

I have some UCF-2 data in a normal string received from a server. How can I get a unicode() string out of this?

EG: >>> something('\0a\0b\0c') = u'abc'

1
  • 1
    I think he means "UCS-2", but needs confirmation. Commented Mar 20, 2012 at 21:55

1 Answer 1

4
>>> '\0a\0b\0c'.decode('UTF-16BE')
u'abc'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.