Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Aidan Kehoe <kehoea@parhasard.net> |
|---|---|
| Newsgroups | comp.emacs |
| Subject | Re: Fixing Garbled Encodings |
| Date | 2026-02-24 07:16 +0000 |
| Message-ID | <87ldgiwr02.fsf@parhasard.net> (permalink) |
| References | (1 earlier) <slrn10p5r9v.42g2.jcb@kotte.inf.ed.ac.uk> <10n0olg$1erpn$1@dont-email.me> <slrn10p932m.5h9c.jcb@kotte.inf.ed.ac.uk> <10nj0eh$3g050$1@dont-email.me> <10nja5p$3j6lg$1@dont-email.me> |
Ar an ceathrú lá is fiche de mí Feabhra, scríobh Lawrence D’Oliveiro: > On Tue, 24 Feb 2026 01:55:29 -0000 (UTC), I wrote: > > > (with-temp-buffer > > (set-buffer-multibyte nil) > > (insert the-text) > > (decode-coding-region (point-min) (point-max) 'utf-8 prevbuf) > > ) ; with-temp-buffer > > You’d think decode-coding-string would achieve the same result, > operating directly on the string value > <https://www.gnu.org/software/emacs/manual/html_node/elisp/Explicit-Encoding.html>; > but it doesn’t. Buffers can be set to multibyte/unibyte mode, but > strings cannot. #'string-as-multibyte, #'string-as-unibyte are the way that’s phrased. > Python has separate “string” and “bytes” types precisely to get around > problems like this; Emacs, it seems, does not. XEmacs doesn’t have either (no “bytes” object, no differential between unibyte and multibyte) and these problems do not really arise, which is, I think, the better approach. That said, the byte code interpreter transforms compiled function instructions (which the Lisp reader reads as strings) to an internal “opaque” type before running them (just a wrapper around a byte array), and that opaque type has the advantage that it doesn’t need the char-byte conversion overhead of strings. Unfortunately it is not otherwise available to Lisp, which has the downside that the application programmer can’t take advantage of it, and that it’s more difficult to test it. If I run out of other XEmacs work I will at some point offer Common Lisp’s (make-array 10 :element-type ’(mod 256))) to create byte arrays in this sense, which will expose that functionality to Lisp and make it more practical to test. -- ‘As I sat looking up at the Guinness ad, I could never figure out / How your man stayed up on the surfboard after fourteen pints of stout’ (C. Moore)
Back to comp.emacs | Previous | Next — Previous in thread | Next in thread | Find similar
Fixing Garbled Encodings Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-02-15 05:48 +0000
Re: Fixing Garbled Encodings Julian Bradfield <jcb@inf.ed.ac.uk> - 2026-02-16 10:11 +0000
Re: Fixing Garbled Encodings Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-02-16 20:35 +0000
Re: Fixing Garbled Encodings Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-02-17 03:52 +0000
Re: Fixing Garbled Encodings Julian Bradfield <jcb@inf.ed.ac.uk> - 2026-02-17 15:42 +0000
Re: Fixing Garbled Encodings Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-02-24 01:55 +0000
Re: Fixing Garbled Encodings Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-02-24 04:41 +0000
Re: Fixing Garbled Encodings Aidan Kehoe <kehoea@parhasard.net> - 2026-02-24 07:16 +0000
Re: Fixing Garbled Encodings Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-02-24 20:24 +0000
Re: Fixing Garbled Encodings "Henry S. Thompson" <ht@home.hst.name> - 2026-02-24 23:02 +0000
Re: Fixing Garbled Encodings Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-02-24 23:52 +0000
Re: Fixing Garbled Encodings "Henry S. Thompson" <ht@home.hst.name> - 2026-02-26 15:35 +0000
Re: Fixing Garbled Encodings Aidan Kehoe <kehoea@parhasard.net> - 2026-02-26 21:24 +0000
Re: Fixing Garbled Encodings Aidan Kehoe <kehoea@parhasard.net> - 2026-02-25 06:39 +0000
Re: Fixing Garbled Encodings Aidan Kehoe <kehoea@parhasard.net> - 2026-02-25 13:55 +0000
csiph-web