Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #197867
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Lawrence D’Oliveiro <ldo@nz.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: open: 'ascii', 'backslashreplace' not behaving as expected - why? |
| Date | Sat, 8 Aug 2026 01:19:32 -0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 17 |
| Message-ID | <1156074$14bmn$1@dont-email.me> (permalink) |
| References | <1155tpv$13on7$1@dont-email.me> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Sat, 08 Aug 2026 01:19:33 +0000 (UTC) |
| Injection-Info | dont-email.me; logging-data="1191639"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cCnZrS5cK4euKzAkfJSEu"; posting-host="c23186fcf2db8d6338e93747057e8f5b" |
| User-Agent | Pan/0.165 (Kostiantynivka) |
| Cancel-Lock | sha1:DtJWWvRrrxZ0o1/zul4BTH3mw+0= sha256:rLt0hHT3uIjc/zmNckWUwQlEcbsnuicq8PBTO1bx2GQ= sha1:Vt/eeFe57jEEMUDUeWV0AdzhfRI= sha256:SomzKZ8FuDhencpyyLsJe8QG4KV7eYbOHMv+TLrQwZs= |
| Xref | csiph.com comp.lang.python:197867 |
Show key headers only | View raw
On Sat, 8 Aug 2026 00:38:24 -0000 (UTC), Veek M wrote:
> 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 ?
Python 3.14.6 (main, Jun 10 2026, 18:54:31) [GCC 15.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> b'\xef\xbf\xbf\n'.decode()
'\uffff\n'
Back to comp.lang.python | Previous | Next — Previous in thread | 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