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

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

bug#31248: 27.0.50; Regression: Multibyte text in HTTP request


From: Lars Ingebrigtsen
Subject: bug#31248: 27.0.50; Regression: Multibyte text in HTTP request
Date: Tue, 24 Apr 2018 14:17:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Aaron Jensen <aaronjensen@gmail.com> writes:

> On Tue, Apr 24, 2018 at 5:06 AM, Lars Ingebrigtsen <larsi@gnus.org> wrote:
>> And this made the entire request string multibyte.
>
> Hm, that's odd. What does that have to do with the url-request-data w/
> the emoji?

That's the *really* obscure bit.  :-)

> If I change that to just an "x" then it won't fail in the
> same way:
>
> (let ((url "http://requestbin.fullcontact.com/1kkmrpx1";)
>       (url-request-method "POST")
>       (url-request-data (encode-coding-string "x" 'utf-8))
>       (url-request-extra-headers '(("Content-Type" . "application/json")))
>       (url-http-proxy nil))
>   (url-retrieve url (lambda (_))))

So you start with a thing that's now multibyte:

(url-host u)
=> "requestbin.fullcontact.com"

(multibyte-string-p (url-host u))
=> t

(setq data (encode-coding-string "📦" 'utf-8))
(multibyte-string-p data)
=> nil

Then concatenate:

(setq foo (concat (url-host u) data))
"\360\237\223\246"
foo
=> "requestbin.fullcontact.com\360\237\223\246"
(multibyte-string-p foo)
=> t
(string-bytes data)
=> 4

(length foo)
=> 30
(string-bytes foo)
=> 34

Fun!  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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