Re: open: 'ascii', 'backslashreplace' not behaving as expected - why?

Veek M <[email protected]>
Newsgroups gmane.comp.python.general
Organization A noiseless patient Spider
Message-ID <[email protected]>
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?
-- 
https://mail.python.org/mailman3//lists/python-list.python.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.