unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Platon Pronko <platon7pronko@gmail.com>
To: Hongyi Zhao <hongyi.zhao@gmail.com>,
	help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: Decode the octets with hexadecimal values.
Date: Sat, 20 May 2023 15:04:08 +0800	[thread overview]
Message-ID: <c2004c79-cbd2-e261-8b70-fb2718b99254@gmail.com> (raw)
In-Reply-To: <CAGP6POKd3_aqHQTC0DD11=GrKm=m9asK0SdmpGVTmwfQ03VJwA@mail.gmail.com>

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




  reply	other threads:[~2023-05-20  7:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-20  6:55 Decode the octets with hexadecimal values Hongyi Zhao
2023-05-20  7:04 ` Platon Pronko [this message]
2023-05-20  7:37   ` Hongyi Zhao
2023-05-20  8:18     ` Eli Zaretskii
2023-05-20  8:51       ` Hongyi Zhao
2023-05-20  9:44         ` Eli Zaretskii
2023-05-20 10:53           ` Hongyi Zhao
2023-05-20 11:01             ` Hongyi Zhao
2023-05-20 12:37               ` Eli Zaretskii
2023-05-20 13:47                 ` Hongyi Zhao

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=c2004c79-cbd2-e261-8b70-fb2718b99254@gmail.com \
    --to=platon7pronko@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=hongyi.zhao@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.
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).