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 21:10:23 -0700 Message-ID: <87wok6bgls.fsf@ericabrahamsen.net> References: <87d0m0qivv.fsf@ericabrahamsen.net> <87zhp3swit.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="3466"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Emacs developers To: Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 07 06:10:49 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 1hCz8q-0000i8-Gz for ged-emacs-devel@m.gmane.org; Sun, 07 Apr 2019 06:10:48 +0200 Original-Received: from localhost ([127.0.0.1]:34087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCz8p-0006Vj-H0 for ged-emacs-devel@m.gmane.org; Sun, 07 Apr 2019 00:10:47 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:60248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCz8i-0006MB-Mh for emacs-devel@gnu.org; Sun, 07 Apr 2019 00:10:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hCz8h-0005oj-MB for emacs-devel@gnu.org; Sun, 07 Apr 2019 00:10:40 -0400 Original-Received: from ericabrahamsen.net ([52.70.2.18]:48148 helo=mail.ericabrahamsen.net) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hCz8h-0005jV-5S for emacs-devel@gnu.org; Sun, 07 Apr 2019 00:10:39 -0400 Original-Received: from localhost (97-113-51-97.tukw.qwest.net [97.113.51.97]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id E1C29FA035; Sun, 7 Apr 2019 04:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ericabrahamsen.net; s=mail; t=1554610230; bh=75MK0Hnsnck6kPd6ThutOnjLuqVLSggNbukMpWSzpZI=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=WeRB5lDuRn3m6XJ74Wo23sF+pzzdEHCvKBPrY/PVoziJwnDVOeG7E4ctmxxkbxwdl GANjiN7QGr8AtY4/7SdSyrHtLxaKdknu9mUZsSwRkcGeXcynpg4WUG0FovuzoK8E0n ELD0w5farhfrvV97p1Vpab4UN4E9/VlS2o9P39zM= In-Reply-To: (Noam Postavsky's message of "Fri, 5 Apr 2019 23:56:55 -0400") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 52.70.2.18 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:235057 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Noam Postavsky writes: > On Fri, 5 Apr 2019 at 22:22, Eric Abrahamsen wr= ote: > >> >> "nnml:\343\203\206\343\202\271\343\203\210" > >> >> "nnml:=C3=A3\203\206=C3=A3\202=C2=B9=C3=A3\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\21= 0")) > > 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))))) =20=20=20=20 I'm trying to turn that into something that looks like "nnml:=C3=A3\203\206=C3=A3\202=C2=B9=C3=A3\203\210" Thanks, Eric --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=active Content-Transfer-Encoding: base64 44OG44K544OIIDEgMSB5Cg== --=-=-=--