brython-dev / brython

Brython (Browser Python) is an implementation of Python 3 running in the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot convert sting to UTF16

mbasaglia opened this issue · comments

I'm struggling with encoding strings to UTF16.

If I try this

"a".encode("utf_16_le")

I get

TypeError: 'utf_16_le' codec returns UndefinedType, not bytes

(I get the same error by using the bytes constructor)

Encoding to UTF8 works fine though

Thanks for the report @mbasaglia !

The commit fixes the bug and also implements utf_16_be and utf-32 encoding / decoding, but still some work ahead (error handling among others).