From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] url: Wrap cookie headers in url-http--encode-string. Date: Fri, 09 Sep 2016 11:06:38 -0400 Message-ID: References: <20160907153014.15752-1-toke@toke.dk> <87inu7k5z4.fsf@toke.dk> <83bmzzaawr.fsf@gnu.org> <877fank1oc.fsf@toke.dk> <87inu6iim8.fsf@toke.dk> <2563921f-d20d-753b-09eb-c8671bc5b6d6@yandex.ru> <87a8fiidso.fsf@toke.dk> <86sht9qfyh.fsf@realize.ch> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1473433648 19929 195.159.176.226 (9 Sep 2016 15:07:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 9 Sep 2016 15:07:28 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 09 17:07:17 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1biNOc-0003nz-0a for ged-emacs-devel@m.gmane.org; Fri, 09 Sep 2016 17:07:14 +0200 Original-Received: from localhost ([::1]:58407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biNOa-0005nb-1l for ged-emacs-devel@m.gmane.org; Fri, 09 Sep 2016 11:07:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biNOQ-0005mx-9T for emacs-devel@gnu.org; Fri, 09 Sep 2016 11:07:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1biNOK-00008k-AM for emacs-devel@gnu.org; Fri, 09 Sep 2016 11:07:01 -0400 Original-Received: from [195.159.176.226] (port=57651 helo=blaine.gmane.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biNOK-00007i-3H for emacs-devel@gnu.org; Fri, 09 Sep 2016 11:06:56 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1biNOA-0000nd-Fx for emacs-devel@gnu.org; Fri, 09 Sep 2016 17:06:46 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 22 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:/cvYOiS8T+7c0fqMUvS93veEyF0= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207313 Archived-At: > (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. Stefan