From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Platon Pronko Newsgroups: gmane.emacs.help Subject: Re: Decode the octets with hexadecimal values. Date: Sat, 20 May 2023 15:04:08 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36790"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 To: Hongyi Zhao , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 20 09:05:03 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 1q0GeE-0009M3-CA for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 20 May 2023 09:05:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q0Gdh-0006Am-GD; Sat, 20 May 2023 03:04:29 -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 1q0GdV-0006AK-1T for help-gnu-emacs@gnu.org; Sat, 20 May 2023 03:04:18 -0400 Original-Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q0GdT-0002UH-9G for help-gnu-emacs@gnu.org; Sat, 20 May 2023 03:04:16 -0400 Original-Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1ae3a5dfa42so29405995ad.0 for ; Sat, 20 May 2023 00:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684566253; x=1687158253; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=SgVYbcWlmIz4dN5PMju1OZdVhbhVf+SOJe1NhCKwXlA=; b=D58QdfgddTUguoLxNDY6yTQCCT/OJMQjnUJye8gytgGpFHa/DfZIHle9927bGcL576 9dLts8WShyiiRFNG8FXEGbIOkCIVnH8vqJ5c1y1XwbGMKdKIBg4fFCIe+VjaJGX3Sdaw oVT1e7ZN3D2n758auq+9RDs1Es+/1EzQpUCVf3dRLU7hUCKCk5O5mZ6gc2YT/kVRldIf VMSzWotRXfDJhhwfhRzfovkAOeqdl8VN9eVG5Ik2eOD6rUFNQasTdYr81K2hV9OUDa2Q Hzm5CEwg5YpyyQetkUM/OgyetC6HlQ/Eg6S4wjX8E9XqIw+FpRi/diPzwyIlH+OIIJjh 19Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684566253; x=1687158253; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SgVYbcWlmIz4dN5PMju1OZdVhbhVf+SOJe1NhCKwXlA=; b=cJVC/pn0PY1QO/gveN7RBh/5OOmKR7oJe4kooenv7GGQ5bkmpTJBrHcCntIdbBziUb 7uVHQh+8ECUh2LgF2abkixEJBS2GJzOTL1dx5D4rIcovMXtmXk/lAcU3qfVNmJmAfyt5 fhPc7z5zIK/owmgAtLIeJmNllvqTjr/gucC5dWO1vXbOiOhOkobAH1dHGjncuRjebxYv rVUByUegeptj42/oysXtEICeSxKQxWxnw9UrKfijt0TYnDAKgOi0JT+Z+Jz09GoCQy56 td2SxxqLugNY0b8M4sNqR2sYkua/7UxX/hUhxCdGJ2t+Z+ZI+jpHDuPMWRZ4sbnS8Rtd Z3Hg== X-Gm-Message-State: AC+VfDyTktUAdw6hJ0fE7Pc/Sn3eHituJI9DUqu4gUZCmnrx1nduf27x ltnFSAz5nQLTXnXaL1OSz5I= X-Google-Smtp-Source: ACHHUZ6y0PNOlaNWDQme5YSXM/JRypvu/agn0NFCJeWi6Pg8HwsRlpgcmzoqiGCXwt1m8C06rzlzgw== X-Received: by 2002:a17:902:ea06:b0:1ac:7d8a:365 with SMTP id s6-20020a170902ea0600b001ac7d8a0365mr5484943plg.26.1684566252966; Sat, 20 May 2023 00:04:12 -0700 (PDT) Original-Received: from [192.163.0.137] ([103.24.106.35]) by smtp.gmail.com with ESMTPSA id h4-20020a170902704400b0019aaab3f9d7sm759697plt.113.2023.05.20.00.04.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 20 May 2023 00:04:12 -0700 (PDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=platon7pronko@gmail.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 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, NICE_REPLY_A=-1.527, 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:143657 Archived-At: 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=20 > of the system service =E2=80=9Cdup2=E2=80=9D to copy the contents of the en= > try #1 to=20 > the entry #2.=C2=A0 Now two entries in the process' file descriptor=20 > table=C2=A0=E2=80=93 #1 and #2=C2=A0=E2=80=93 refer to the opened file =E2= > =80=9Coutput.txt=E2=80=9D. > > 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=165151671300 > > Best, > Zhao Hi! That looks like quoted-printable encoding. I don't know how to decode that in Emacs, but here's an example of how you can do that in Python: import codecs s = """ the shell first will do the same and then tell the kernel by means=20 of the system service =E2=80=9Cdup2=E2=80=9D to copy the contents of the en= try #1 to=20 the entry #2.=C2=A0 Now two entries in the process' file descriptor=20 table=C2=A0=E2=80=93 #1 and #2=C2=A0=E2=80=93 refer to the opened file =E2= =80=9Coutput.txt=E2=80=9D. """ print(codecs.decode(s.encode("utf8"), "QUOTED-PRINTABLE").decode("utf8").strip()) -- Best regards, Platon Pronko PGP 2A62D77A7A2CB94E