Groups | Search | Server Info | Login | Register
| From | Julian Bradfield <jcb@inf.ed.ac.uk> |
|---|---|
| Newsgroups | comp.emacs |
| Subject | Re: Fixing Garbled Encodings |
| Date | 2026-02-17 15:42 +0000 |
| Message-ID | <slrn10p932m.5h9c.jcb@kotte.inf.ed.ac.uk> (permalink) |
| References | <10mrmnj$3obvm$4@dont-email.me> <slrn10p5r9v.42g2.jcb@kotte.inf.ed.ac.uk> <10n0olg$1erpn$1@dont-email.me> |
On 2026-02-17, Lawrence D’Oliveiro <ldo@nz.invalid> wrote:
> it seems to do nothing with the output of this short Python script:
>
> s = "“—”"
> print("".join(chr(c) for c in s.encode()))
>
> Ensure you capture the output directly from a subprocess into an Emacs
> buffer, rather than copying/pasting via a terminal or anything else.
> For me, the output looks like this
>
> â\200\234â\200\224â\200\235
>
> except that each backslash-octal sequence is a single character (shown
> in red, obviously to indicate an unrecognized character code). When I
> try applying decode-coding-region to this text, it is left unchanged.
Works fine for me on XEmacs, so this must be something to do with the
way FSFmacs handles multibyte vs single byte encodings.
Try this:
(defun utf8decode ()
"Decode the region as utf-8. Mainly for doubly encoded emails."
(interactive)
(kill-region 0 0 t)
(let ((mybuf (current-buffer)))
(with-temp-buffer
(set-buffer-multibyte nil)
(yank)
(decode-coding-region 1 (point-max) 'utf-8 mybuf)))
)
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