From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam Porter Newsgroups: gmane.emacs.devel Subject: Re: How to get buffer byte length (not number of characters)? Date: Fri, 23 Aug 2024 01:28:19 -0500 Message-ID: <3af7761b-a24a-47cd-9083-5f7795bdd971@alphapapa.net> References: <87wmkbekjp.fsf@ushin.org> <86o75nwilg.fsf@gnu.org> <87bk1lhkvg.fsf@ushin.org> <86y14pu5rp.fsf@gnu.org> <871q2hfn7c.fsf@ushin.org> <86plq1td4n.fsf@gnu.org> <87ed6hdnpe.fsf@ushin.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2915"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Joseph Turner , Eli Zaretskii , emacs-devel@gnu.org, schwab@suse.de To: tomas@tuxteam.de Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 23 08:29:29 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1shNnd-0000cr-Fr for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Aug 2024 08:29:29 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shNmf-0008Ii-MN; Fri, 23 Aug 2024 02:28:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1shNmd-0008IK-S2 for emacs-devel@gnu.org; Fri, 23 Aug 2024 02:28:27 -0400 Original-Received: from black.elm.relay.mailchannels.net ([23.83.212.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1shNmc-0005fW-1T; Fri, 23 Aug 2024 02:28:27 -0400 X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 1E3D7C5CCC; Fri, 23 Aug 2024 06:28:22 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a289.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 89BEDC528F; Fri, 23 Aug 2024 06:28:21 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1724394501; a=rsa-sha256; cv=none; b=2VTgd46aNa74r9hGJdkujOoKLM/14YQJOcl9/eluNw7FeTLf4tzNCp1/YoF2qWCvS6umT9 7QGGmXNrFudfrLyYix2qngfm3Uoc5RmfdHaLpm4NjScAaSQcOjDDjj/eedCZ1bbf940baj NbOY+tJXRBEqp0k5fNgi4Is4P2N1Uz7spCm3/WGT0q7dHAc13jFT5jByFHHvnKXCjwKBYY ehcoH2W3ddqds5TPEdKjZAlODWoEJwBDILOhpr/2IBa4vj3U0nLaunwGivOry+Euuv++DR HBT03w+vVrufYu88UNQqZ0R8n0GQX9vJ7w1fwuzOaHibQeppM7CC08/jKkasCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1724394501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=a+v6lAJXt/oHDGbqQniuK+WUW9d5OH9Dp/eofA/Yo4g=; b=9TfF9eNfx87vf4OhTYlyOFRE9Wqk0wPAlBrUA8E8prScyOzPk3yUgAQckXihwpuPgR8g08 5N4jhKvz5UKi+JBq1OogLi3Oa0XvtyugAkDDcqmGxbrBhiMSGCuOR7+Q2wchipO14lVzFW pLIj/rTq8ar5bzfI/CfpCQGEYD9UlPJY9I0sN5zQLHcNlq09r7Tq+NPaoXFd91jQV1EF87 KbhBDalOj/Nnd+VaqyHv1yu3GTXwJYyFlgRVhVs3XvxhlSjKaP23MB1PN0l0k3CP8eWk7U zNcDvIHj+s6+iP2RPsG4ssbTHg4ayLwBH+aF5Io9gQf4WVxey+QQLiMF57fYdg== ARC-Authentication-Results: i=1; rspamd-cf944896d-lddkp; auth=pass smtp.auth=dreamhost smtp.mailfrom=adam@alphapapa.net X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|adam@alphapapa.net X-MailChannels-Auth-Id: dreamhost X-Chemical-Macabre: 0d4b46745e8b3475_1724394502021_3065115862 X-MC-Loop-Signature: 1724394502020:2284301050 X-MC-Ingress-Time: 1724394502020 Original-Received: from pdx1-sub0-mail-a289.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.101.113.197 (trex/7.0.2); Fri, 23 Aug 2024 06:28:22 +0000 Original-Received: from [10.43.127.69] (unknown [193.56.116.15]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: adam@alphapapa.net) by pdx1-sub0-mail-a289.dreamhost.com (Postfix) with ESMTPSA id 4Wqqrh5FrRz3f; Thu, 22 Aug 2024 23:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alphapapa.net; s=dreamhost; t=1724394501; bh=a+v6lAJXt/oHDGbqQniuK+WUW9d5OH9Dp/eofA/Yo4g=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=iVkMTxXa0FdCHawnokaRZgeuKMXCeYQkpDpxWgJOIxTM1385599uPFoTR9dg8aLk1 FwgchjO65empO5DxnyDuCIbWgqfxMDjiK8xJch+BFqXzgS4plw3m/7ApfFfy8pJE1x ROzoaSRQ7ZjlcEiYWdrnfogS4oLN9PhrnDiLnbji0cwRushlq50wLCGSvI8WxPzaOu KejKqXiPAko3iABS3WBCq6HqKoBGXOzv55yOYxNd3+54bhATubY/5aevEcvbVHfiAx BdPJex1/q/fi+/08/sZk2T/rEX1ESyxjF/pc7rdTFbMZmq2IejTiiwvnsqetMp87cc uUGIoimVmBVYA== Content-Language: en-US In-Reply-To: Received-SPF: neutral client-ip=23.83.212.19; envelope-from=adam@alphapapa.net; helo=black.elm.relay.mailchannels.net X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:323069 Archived-At: On 8/22/24 07:47, tomas@tuxteam.de wrote: > Another point I haven't seen in this discussion is that HTTP also may > carry metadata about what it thinks the content encoding is. This may > involve the server configuration too. > > You may choose to ignore it, but then you need to convince all the > moving parts to agree on that (i.e. an Apache on the other side might > happily tell your client that it is sending "text/plain; charset=UTF-8" > or something similarly funny (note: UTF-8 isn't a charset :-) depending > on the web server config, the content of some mimetype database and > so on. > > You'll have to make sure curl and Emacs do the right thing with that > (which might be "nothing"). plz optionally decodes response bodies according to the content-type header, depending on the :decode argument (although Joseph found a bug in the implementation of that, and I'll merge his fix soon). plz does not do anything else, e.g. setting a buffer's coding system variables. If :decode is nil, plz does no decoding and leaves it to the user. For HTML, with its potential for having a META tag that may also specify encoding, that would be up to the user; plz offers no special support for various content types. If a user wants to handle these issues manually, the ":as 'response" argument to plz should be used, which allows the user to process the response headers and body directly.