[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: recode-region.el --- correct incorrectly encoded text
From: |
Magnus Henoch |
Subject: |
Re: recode-region.el --- correct incorrectly encoded text |
Date: |
Mon, 29 Nov 2004 21:00:58 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (darwin) |
Stefan Monnier <address@hidden> writes:
>> (defun recode-string (string was-really interpreted-as)
>> (decode-coding-string
>> (encode-coding-string (string-make-unibyte string) interpreted-as)
> ^^^^^^^^^^^^^^^^^^^
>> was-really))
>
> The call to string-make-unibyte looks wrong since it throws away
> information. Also encode-coding-string takes a multibyte string as input,
> so I'd just use
>
> (decode-coding-string (encode-coding-string string interpreted-as) was-really)
Indeed, now it works... I must have done something stupid when I
tested that first.
> In Emacs-21, you can say:
>
> (insert (recode-string (delete--and-extract-region start end)
> was-really interpreted-as))
Thanks for the hint!
Magnus