From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joseph Turner Newsgroups: gmane.emacs.devel Subject: Re: How to get buffer byte length (not number of characters)? Date: Thu, 22 Aug 2024 11:29:48 -0700 Message-ID: <87ttfcl8bn.fsf@ushin.org> 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> <865xrsu8c8.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23953"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, schwab@suse.de, adam@alphapapa.net To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Aug 22 20:45:13 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 1shCo4-00062h-Ja for ged-emacs-devel@m.gmane-mx.org; Thu, 22 Aug 2024 20:45:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shCno-0007hY-GE; Thu, 22 Aug 2024 14:44:57 -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 1shCZN-0004ZY-Ge for emacs-devel@gnu.org; Thu, 22 Aug 2024 14:30:02 -0400 Original-Received: from out-180.mta0.migadu.com ([2001:41d0:1004:224b::b4]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1shCZK-0000oy-6C for emacs-devel@gnu.org; Thu, 22 Aug 2024 14:30:01 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ushin.org; s=key1; t=1724351393; 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: in-reply-to:in-reply-to:references:references; bh=Dz2xkNqvqJGk7vzIyYmJqUUjMwhbLHLOa6r2wRPrbXc=; b=JGNzFn97GGOitSofaZyflj9Bhbod3YFmRZB9pOdlx2v1PvJ58D1bmtiPPW4+j39LXAtN0l KOv3+NrfhmJzX+SAMj/nhU4ZQpGfC41/kV3y5+/NlFHQGQFjS4QaVRd5Neq+3wu8F9pdhG YkKvShZLT5m6OULZZ1pgMcH0A2fJIR6iLO78XleR1W9yvuXkm0GC/4iVMDjmqAPzn7eGEb Zf3ggBZhntpvNPHwTGkjtiVUZle+QseukJ6AmpP9mqnP126b1/+fZtNkbr0rj7uRfrz77m jOZXaZ1wTd7bW804mVHuOMEDyPhark34+SgF4wkI283kx6aRt9jYgUUqaIh/sg== In-Reply-To: <865xrsu8c8.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 22 Aug 2024 14:04:39 +0300") X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::b4; envelope-from=joseph@ushin.org; helo=out-180.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 22 Aug 2024 14:44:44 -0400 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:323056 Archived-At: Eli Zaretskii writes: >> From: Joseph Turner >> Cc: emacs-devel@gnu.org, schwab@suse.de, adam@alphapapa.net >> Date: Thu, 22 Aug 2024 00:24:45 -0700 >> >> > So maybe I misunderstand how these plz.el facilities are used, but up >> > front this sounds like a mistake. >> >> It could be. Eli, Adam, what do you think about the default coding >> systems for encoding the request body in the attached patch? > > I think it is better to use detect-coding-region instead, if > buffer-file-coding-system is undecided. detect-coding-region is only useful when decoding text, right? For encoding text, should we encode with buffer-file-coding-system? >> > By "optionally" you mean that it doesn't always happen, except if the >> > caller requests that? If so, the caller of plz.el should decode the >> > text manually before using it in user-facing features. >> >> By default, `plz' decodes response body according to the 'Content-Type' >> charset (or utf-8 as fallback). Passing `:decode nil' stops that. > > Sounds correct. When decoding, should plz fallback to detect-coding-region instead of utf-8? >> default-file-name-coding-system? > > That's for file names, so it is not what you want here. Thanks! So when decoding text in hyperdrive.el, we can use (1) Content-Type charset, or (2) use `detect-coding-region' as a fallback. IIUC, there's no need to use `set-auto-coding', since `detect-coding-region' DTRT. Joseph