From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: Noam Postavsky <npostavs@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Fixing Gnus, and string encoding question
Date: Sat, 06 Apr 2019 21:10:23 -0700 [thread overview]
Message-ID: <87wok6bgls.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <CAM-tV-9F6Tt=wbnxwkyAjDc2-tdQhgipmY8+BCOSdrYk+BfvoA@mail.gmail.com> (Noam Postavsky's message of "Fri, 5 Apr 2019 23:56:55 -0400")
[-- Attachment #1: Type: text/plain, Size: 2283 bytes --]
Noam Postavsky <npostavs@gmail.com> writes:
> On Fri, 5 Apr 2019 at 22:22, Eric Abrahamsen <eric@ericabrahamsen.net> 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
[-- Attachment #2: active --]
[-- Type: application/octet-stream, Size: 16 bytes --]
テスト 1 1 y
next prev parent reply other threads:[~2019-04-07 4:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-05 20:47 Fixing Gnus, and string encoding question Eric Abrahamsen
2019-04-06 1:40 ` Noam Postavsky
2019-04-06 2:22 ` Eric Abrahamsen
2019-04-06 3:56 ` Noam Postavsky
2019-04-07 2:32 ` Eric Abrahamsen
2019-04-07 4:10 ` Eric Abrahamsen [this message]
2019-04-07 7:05 ` Andreas Schwab
2019-04-07 17:17 ` Eric Abrahamsen
2019-04-07 11:59 ` Noam Postavsky
2019-04-07 12:18 ` Andreas Schwab
2019-04-07 12:41 ` Andreas Schwab
2019-04-06 6:20 ` Eli Zaretskii
2019-04-07 2:30 ` Eric Abrahamsen
2019-04-06 8:26 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wok6bgls.fsf@ericabrahamsen.net \
--to=eric@ericabrahamsen.net \
--cc=emacs-devel@gnu.org \
--cc=npostavs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).