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: Hongyi Zhao
Subject: Re: Decode the octets with hexadecimal values.
Date: Sat, 20 May 2023 15:37:42 +0800

On Sat, May 20, 2023 at 3:04 PM Platon Pronko <platon7pronko@gmail.com> 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=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())

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



reply via email to

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