all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Yuri Khan <yuri.v.khan@gmail.com>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Decoding URLs input
Date: Sat, 03 Jul 2021 12:04:25 +0000	[thread overview]
Message-ID: <F51E1FBF-F6D1-4628-A750-DAA0D6C45881@gnu.support> (raw)
In-Reply-To: <CAP_d_8WpokFrwzv=6ECqrbv_AX0V3nSYGOx+DBrcshqBV+piXA@mail.gmail.com>

I appreciate this tip and will test it

On July 3, 2021 11:10:47 AM UTC, Yuri Khan <yuri.v.khan@gmail.com> wrote:
>On Sat, 3 Jul 2021 at 16:41, Jean Louis <bugs@gnu.support> wrote:
>
>> As I am developing Double Opt-In CGI script served by Emacs I am
>> unsure if this function is correct to be used the encoded strings
>that
>> come from URL GET requests, like
>http://www.example.com/?message=Hello%20There
>>
>> (rfc2231-decode-encoded-string "Hello%20there") ⇒ "Hello there"
>>
>> If anybody knows or have clues, let me know. In other programming
>> languages I have not been thinking of RFC, I don't know which RFC
>> applies there.
>
>Why not look at the RFC referenced in order to see whether it is or is
>not relevant to your task?
>
>https://datatracker.ietf.org/doc/html/rfc2231
>
>It talks about encoding MIME headers, which is not what you’re dealing
>with; and its encoded strings look like
><encoding>'<locale>'<percent-encoded-string>, which is not what you
>have.
>
>What you are dealing with is a URL, specifically, its query string
>part. These are described in RFC 3986, and its percent-encoding scheme
>in sections 2.1 and 2.5.
>
>(url-unhex-string …) will do half the work for you: It will decode
>percent-encoded sequences into bytes. By convention, in URLs,
>characters are UTF-8-encoded before percent-encoding (see RFC 3986 §
>2.5), so you’ll need to use:
>
>    (decode-coding-string (url-unhex-string s) 'utf-8)
>
>to get a fully decoded text string.


Jean



  reply	other threads:[~2021-07-03 12:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-03  9:40 Decoding URLs input Jean Louis
2021-07-03  9:56 ` Jean Louis
2021-07-03 11:10 ` Yuri Khan
2021-07-03 12:04   ` Jean Louis [this message]
2021-07-03 19:17   ` Jean Louis
2021-07-03 20:16     ` Yuri Khan
2021-07-03 22:18       ` Jean Louis
2021-07-04  4:22       ` Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F51E1FBF-F6D1-4628-A750-DAA0D6C45881@gnu.support \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    --cc=yuri.v.khan@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.