[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 17:16:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt)

Eli Zaretskii <address@hidden> writes:

>> (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
> Because a multibyte string with ASCII-only text has the same number of
> bytes as it has characters.  While a multibyte string with non-ASCII
> text has more bytes than characters, due to the way Emacs represents
> characters internally (which is actually a superset of UTF-8).
>> Why does concat behave that strangely?  What am I missing here?  Is the
>> behavior of concatenating a unibyte and a multibyte string simply
>> undefined?
> No, it isn't undefined.  When some of the arguments are multibyte
> strings, concat returns a multibyte string.  Nothing else would make
> sense.


reply via email to

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