help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Decode the octets with hexadecimal values.


From: Platon Pronko
Subject: Re: Decode the octets with hexadecimal values.
Date: Sat, 20 May 2023 15:04:08 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

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 via email to

[Prev in Thread] Current Thread [Next in Thread]