From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: Decode the octets with hexadecimal values. Date: Sat, 20 May 2023 15:37:42 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31130"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Platon Pronko Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 20 09:38:25 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q0HAW-0007sr-RW for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 20 May 2023 09:38:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q0HA8-0004z9-Iq; Sat, 20 May 2023 03:38:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q0HA6-0004yr-UY for help-gnu-emacs@gnu.org; Sat, 20 May 2023 03:37:58 -0400 Original-Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q0HA5-0007nZ-5i for help-gnu-emacs@gnu.org; Sat, 20 May 2023 03:37:58 -0400 Original-Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-96f0678de80so748253066b.3 for ; Sat, 20 May 2023 00:37:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684568274; x=1687160274; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=SUlKxKvxmPzZjNS0xxhYIFuNdvYjgxDvZBVhwKC+bJU=; b=jXT/pmB6fOpb0+3kKyV+fb4vP9rVrSlsqFmRTcG3GfP0MpVYOQzyl7hssd2liKyoBL B09EFstseRtAzgyIxA6ErXBafsyl4sHcIbw9T5R6mtyZe0HqDwpB0s1fYda8pltvVVKB kkuNbRNM2WkrxYU9eBt5cSJFdRVEvU4Xb55ePa04dUk0rlnnY+Bjm+6gB67ZOG2t/iPi BXJHX3NYuuqw4/uzEohw+iJ9C9PPV/dFdWq6OpvoCSc4hq0svjgIW0oFtjgZ0QK2vcQm HRzRcyuuYMb7F1uKo0+9o5tSIa19ndeqqB38GfjDU0Ks9Ea7Nh5q3Nox4C/Qkce1Aygw DoSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684568274; x=1687160274; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SUlKxKvxmPzZjNS0xxhYIFuNdvYjgxDvZBVhwKC+bJU=; b=DjlFzF1skvdiALf39KqSXFJ+i56muQu1rtKihG6B0uvECOAMdwOaB8CmVvVX5dq/FQ D6LIRxf10LxCL9NzAc7vbBggszQ9R8wDTo7UcGJ7fj6bUDJ5ol2Piof8YLKH2Q/BrTMQ PuKxG/PpnJY55rfkeWG7v88GXsLHGT5Y+gyjFdtl3wvhTns30tvsJOXxqyz2phFbxGfI Qt5zz07bAjezjPJhO4MB5iklh+Rlgt1L05yQFygLNhzvpenm249rKFdzD3zQiBEtYqpO m5ntGE4RcGR0Cia+0RXUZcJHnmRJ1JBBJw7O26xXhqWeqopUCcrW0O1+Zl1L14BRbsWO Vnhg== X-Gm-Message-State: AC+VfDwSXTPP6sBdtHiEAeUbyqgp938cYW6N8by4HlmeCmvbApcdsLwA Ygunj54cgjPoYMnoqo9fjMpBl8YQCGLhbzfFeez3+f74a8+Tcg== X-Google-Smtp-Source: ACHHUZ7d3WeX0JByd5vBxTYSbgoTe7jqojVfLiQhmmYQmRDcrx5B6TRu4AxIDEfQDthALKK01RFmD1kWqadgARaX/F8= X-Received: by 2002:a17:907:6eac:b0:94e:116:8581 with SMTP id sh44-20020a1709076eac00b0094e01168581mr6167793ejc.5.1684568274141; Sat, 20 May 2023 00:37:54 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=hongyi.zhao@gmail.com; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:143658 Archived-At: On Sat, May 20, 2023 at 3:04=E2=80=AFPM Platon Pronko wrote: > > On 2023-05-20 14:55, Hongyi Zhao wrote: > > Hi here, > > > > According to one of the comments here [1], I try to read the related > > discussion here [2], but al.howardknight.net doesn't do any decoding > > of the articles and I will see some non-human readable stuff, for > > example: > > > > the shell first will do the same and then tell the kernel by means=3D20 > > of the system service =3DE2=3D80=3D9Cdup2=3DE2=3D80=3D9D to copy the co= ntents of the en=3D > > try #1 to=3D20 > > the entry #2.=3DC2=3DA0 Now two entries in the process' file descriptor= =3D20 > > table=3DC2=3DA0=3DE2=3D80=3D93 #1 and #2=3DC2=3DA0=3DE2=3D80=3D93 refer= to the opened file =3DE2=3D > > =3D80=3D9Coutput.txt=3DE2=3D80=3D9D. > > > > So, I would like to know how to decode the octets with hexadecimal > > values with the help of Emacs. > > > > [1] https://groups.google.com/g/comp.unix.shell/c/xXqxHrIchqg > > [2] http://al.howardknight.net/?ID=3D165151671300 > > > > Best, > > Zhao > > Hi! > > That looks like quoted-printable encoding. I don't know how to decode tha= t in Emacs, > but here's an example of how you can do that in Python: > > import codecs > s =3D """ > the shell first will do the same and then tell the kernel by means=3D20 > of the system service =3DE2=3D80=3D9Cdup2=3DE2=3D80=3D9D to copy the cont= ents of the en=3D > try #1 to=3D20 > the entry #2.=3DC2=3DA0 Now two entries in the process' file descriptor= =3D20 > table=3DC2=3DA0=3DE2=3D80=3D93 #1 and #2=3DC2=3DA0=3DE2=3D80=3D93 refer t= o the opened file =3DE2=3D > =3D80=3D9Coutput.txt=3DE2=3D80=3D9D. > """ > print(codecs.decode(s.encode("utf8"), "QUOTED-PRINTABLE").decode("utf8").= strip()) Yes. This works. But Emacs is also extremely powerful, I expect someone here can give an Emacs-based solution. > -- > Best regards, > Platon Pronko > PGP 2A62D77A7A2CB94E Regards, Zhao