Issue 33143: encode UTF-16 generates unexpected results (original) (raw)

Issue33143

Created on 2018-03-26 09:26 by anders.rundgren.net@gmail.com, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg314443 - (view) Author: Anders Rundgren (anders.rundgren.net@gmail.com) Date: 2018-03-26 09:26
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> v = '\u20ac' >>> print (v) € >>> v.encode('utf-16') b'\xff\xfe\xac ' >>> v.encode('utf-16_be') b' \xac' I had expected to get pair of bytes with 20 AC for the € symbol
msg314445 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-03-26 10:22
b'\x20' is the same as b' '.
msg314451 - (view) Author: Anders Rundgren (anders.rundgren.net@gmail.com) Date: 2018-03-26 12:52
Thanx for the superquick response! I really appreciate it. I'm obviously a Python n00b Anders
History
Date User Action Args
2022-04-11 14:58:59 admin set github: 77324
2018-03-26 12:52:59 anders.rundgren.net@gmail.com set messages: +
2018-03-26 10:22:29 serhiy.storchaka set status: open -> closednosy: + serhiy.storchakamessages: + resolution: not a bugstage: resolved
2018-03-26 09:26:20 anders.rundgren.net@gmail.com create