From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: Fixing Gnus, and string encoding question Date: Sat, 06 Apr 2019 19:32:48 -0700 Message-ID: <87lg0msfxr.fsf@ericabrahamsen.net> References: <87d0m0qivv.fsf@ericabrahamsen.net> <87zhp3swit.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="156443"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 07 04:35:43 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hCxep-000ea5-GA for ged-emacs-devel@m.gmane.org; Sun, 07 Apr 2019 04:35:43 +0200 Original-Received: from localhost ([127.0.0.1]:33332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCxeo-0001Qa-HR for ged-emacs-devel@m.gmane.org; Sat, 06 Apr 2019 22:35:42 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCxeD-0001QH-Hb for emacs-devel@gnu.org; Sat, 06 Apr 2019 22:35:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hCxeC-0001jm-Ig for emacs-devel@gnu.org; Sat, 06 Apr 2019 22:35:05 -0400 Original-Received: from [195.159.176.226] (port=58746 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hCxeC-0001je-AO for emacs-devel@gnu.org; Sat, 06 Apr 2019 22:35:04 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1hCxeA-000dpN-JB for emacs-devel@gnu.org; Sun, 07 Apr 2019 04:35:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ Cancel-Lock: sha1:ltsJ2g1y30dHQQd4EKX2Zvocy/g= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235052 Archived-At: Noam Postavsky writes: > On Fri, 5 Apr 2019 at 22:22, Eric Abrahamsen 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. Well that is weird and I would never have discovered it on my own -- thank you! I'm going to try to put together a patch using this now. Thanks again, Eric