Get unicode string from binary data in python

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

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

=u'abc'

+3


source to share


1 answer


>>> '\0a\0b\0c'.decode('UTF-16BE')
u'abc'

      



+4


source







All Articles