[Top][All Lists]

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

Re: [PATCH] url: Wrap cookie headers in url-http--encode-string.

From: Alain Schneble
Subject: Re: [PATCH] url: Wrap cookie headers in url-http--encode-string.
Date: Fri, 9 Sep 2016 16:56:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt)

Toke Høiland-Jørgensen <address@hidden> writes:

> Dmitry Gutov <address@hidden> writes:
>> Could you post the full recipe?
> (url-retrieve-synchronously "http://google.se";) ; sets a cookie
> (let* ((url-request-data (encode-coding-string "æøå" 'utf-8)))
>        (url-retrieve-synchronously "http://google.se";)) ; crashes

I was able to reproduce it but am a bit confused, since it doesn't
signal an error when message-body "æøå" is replaced by "abc", while
reusing the same cookie.

I tried to track it down with the following example. `cookie-val' is the
value of the cookie-string:

(string-bytes cookie-val)
=> 131
(string-bytes (encode-coding-string "æøå" 'utf-8))
=> 6
(string-bytes (concat (encode-coding-string "æøå" 'utf-8) cookie-val))
=> 143 ' why?
(string-bytes (concat (string-as-unibyte "abc") ans-cookie-val))
=> 134

Why does concat behave that strangely?  What am I missing here?  Is the
behavior of concatenating a unibyte and a multibyte string simply
undefined?  But if so, shouldn't that be mentioned in the docstring?  Or
is it a general rule that has to be followed, to not mix uni-/multibyte
in any function?

Please excuse me if that seems to be a silly question to you.  I just
want to learn and understand how that really works behind the scenes.

Thanks for any help.

reply via email to

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