|
From: | Alain Schneble |
Subject: | Re: [PATCH] url: Wrap cookie headers in url-http--encode-string. |
Date: | Fri, 9 Sep 2016 17:15:50 +0200 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt) |
Stefan Monnier <address@hidden> writes: >> (string-bytes cookie-val) >> => 131 > > This says that the internal representation of the cookie-val string uses > up 131 bytes. > >> (string-bytes (encode-coding-string "æøå" 'utf-8)) >> => 6 > > Note that `length' should return the same value, since the string > returned by encode-coding-string should be unibyte (i.e. is a sequence of > bytes, rather than sequence of characters). > >> (string-bytes (concat (encode-coding-string "æøå" 'utf-8) cookie-val)) >> => 143 ' why? > > Because the concatenation needs to convert the bytes held in the first > string into chars. The internal representation of bytes >=128 as chars > takes up 2 bytes. Your last sentence explains the behavior I did not understand. Thanks!
[Prev in Thread] | Current Thread | [Next in Thread] |