On Sat, 8 Aug 2026 04:22:59 -0000 (UTC), Veek M wrote:

> On Sat, 8 Aug 2026 01:19:32 -0000 (UTC), Lawrence D’Oliveiro wrote:
> 
>> b'\xef\xbf\xbf\n'.decode()
> 
> Could you explain how it works and what exactly is going on?
> 
> fh.readline() returns a unicode string with the funny chars (bytes 0xff
> 0xff) encoded as \\xef \\xbf \\xbf - why is it \\? why not just use a
> single u'\xef\xbf\xbf' - why is he escaping the '\'.
> 
> Also - how exactly is he getting ef bf bf and not ff ff?

oh is 0xff 0xff when encoded to disk in utf-8 
(sys.getsystemdefaultencoding) 0xef 0xbf 0xbf?
-- 
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to