Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #197866
| From | Veek M <veekjunk@foobar.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | open: 'ascii', 'backslashreplace' not behaving as expected - why? |
| Date | 2026-08-08 00:38 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <1155tpv$13on7$1@dont-email.me> (permalink) |
So in kate, i Ctrl-Shift-U and type ffff to enter a unicode codepoint of
0xffff. Then at the REPL prompt i do
fh = open('/tmp/x', 'rt', -1, 'ascii', 'backslashreplace', None)
and i get
fh.readline()
'\\xef\\xbf\\xbf\n'
Since I wrote two bytes 0xff and 0xff into Kate - why am i getting 0xef
0xbf and 0xbf ?
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
open: 'ascii', 'backslashreplace' not behaving as expected - why? Veek M <veekjunk@foobar.com> - 2026-08-08 00:38 +0000
Re: open: 'ascii', 'backslashreplace' not behaving as expected - why? Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-08 01:19 +0000
Re: open: 'ascii', 'backslashreplace' not behaving as expected - why? Veek M <veekjunk@foobar.com> - 2026-08-08 04:22 +0000
Re: open: 'ascii', 'backslashreplace' not behaving as expected - why? Veek M <veekjunk@foobar.com> - 2026-08-08 04:25 +0000
Re: open: 'ascii', 'backslashreplace' not behaving as expected - why? Veek M <veekjunk@foobar.com> - 2026-08-08 04:33 +0000
Re: open: 'ascii', 'backslashreplace' not behaving as expected - why? Greg Ewing <greg.ewing@canterbury.ac.nz> - 2026-08-10 12:08 +1200
csiph-web