[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fixing Gnus, and string encoding question
From: |
Eric Abrahamsen |
Subject: |
Re: Fixing Gnus, and string encoding question |
Date: |
Sat, 06 Apr 2019 21:10:23 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Noam Postavsky <address@hidden> writes:
> On Fri, 5 Apr 2019 at 22:22, Eric Abrahamsen <address@hidden> wrote:
>
>> >> "nnml:\343\203\206\343\202\271\343\203\210"
>
>> >> "nnml:ã\203\206ã\202¹ã\203\210"
>
>> > Are you maybe looking for decode-coding-string?
>
>> No, unfortunately -- that would make everything much easier. Eventually
>> the idea will be to decode the strings into plain utf-8-emacs, but for
>> now I'm stuck keeping them in this weird half-state. I literally need a
>> conversion between the two versions above.
>
> Oh, I missed which two string you meant. It seems that evaluating the
> 1st string with C-x C-e prints the second string in the *Messages*
> buffer (I initially thought they were the same string), but
> printing/inserting it doesn't work the same. The message code prints
> one character at a time, and indeed, inserting one character at a time
> in lisp works too:
>
> (let ((s "nnml:\343\203\206\343\202\271\343\203\210"))
> (with-temp-buffer
> (mapc #'insert s)
> (buffer-string)))
>
> The following shorter expression also seem to work:
>
> (apply #'string (string-to-list "nnml:\343\203\206\343\202\271\343\203\210"))
>
> And apply #'unibyte-string goes back again:
>
> (let* ((s1 "nnml:\343\203\206\343\202\271\343\203\210")
> (s2 (apply #'string (string-to-list s1))))
> (apply #'unibyte-string (string-to-list s2)))
>
> I can't say I completely understand why all this works though.
No, I spoke too soon. It must be another case of a string that doesn't
quite look like what it actually is. The string that looks like
"nnml:\343\203" etc must be something different: when I run your example
using a typed-in version of the string it behaves correctly, but when I
run it with the actual string I'm working with, the apply #'string
doesn't change it.
You can get the string I'm fighting with by saving the attached file and
running:
(with-temp-buffer
(set-buffer-multibyte t)
(let ((coding-system-for-read 'raw-text))
(insert-file-contents "active")
(goto-char (point-min))
(symbol-name (read (current-buffer)))))
I'm trying to turn that into something that looks like
"nnml:ã\203\206ã\202¹ã\203\210"
Thanks,
Eric
active
Description: Binary data
- Fixing Gnus, and string encoding question, Eric Abrahamsen, 2019/04/05
- Re: Fixing Gnus, and string encoding question, Noam Postavsky, 2019/04/05
- Re: Fixing Gnus, and string encoding question, Eric Abrahamsen, 2019/04/05
- Re: Fixing Gnus, and string encoding question, Noam Postavsky, 2019/04/05
- Re: Fixing Gnus, and string encoding question, Eric Abrahamsen, 2019/04/06
- Re: Fixing Gnus, and string encoding question,
Eric Abrahamsen <=
- Re: Fixing Gnus, and string encoding question, Andreas Schwab, 2019/04/07
- Re: Fixing Gnus, and string encoding question, Eric Abrahamsen, 2019/04/07
- Re: Fixing Gnus, and string encoding question, Noam Postavsky, 2019/04/07
- Re: Fixing Gnus, and string encoding question, Andreas Schwab, 2019/04/07
- Re: Fixing Gnus, and string encoding question, Andreas Schwab, 2019/04/07
- Re: Fixing Gnus, and string encoding question, Eli Zaretskii, 2019/04/06
- Re: Fixing Gnus, and string encoding question, Eric Abrahamsen, 2019/04/06
Re: Fixing Gnus, and string encoding question, Andreas Schwab, 2019/04/06