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 00:30:51 -0700 Message-ID: <87a5h5dnf8.fsf@ushin.org> References: <87wmkbekjp.fsf@ushin.org> <86o75nwilg.fsf@gnu.org> <87bk1lhkvg.fsf@ushin.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="28647"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org, Adam Porter To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Aug 22 12:02:40 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 1sh4eN-0007HU-Lc for ged-emacs-devel@m.gmane-mx.org; Thu, 22 Aug 2024 12:02:40 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sh4dX-0003d2-L8; Thu, 22 Aug 2024 06:01:47 -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 1sh2Hd-00013o-Tu for emacs-devel@gnu.org; Thu, 22 Aug 2024 03:31:01 -0400 Original-Received: from out-186.mta0.migadu.com ([2001:41d0:1004:224b::ba]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sh2HZ-0003bH-KA for emacs-devel@gnu.org; Thu, 22 Aug 2024 03:31:00 -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=1724311855; 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=8G8NvF5hzDPrt608yK7KKJcYdXpsNwvoXewe3JQsszo=; b=K1qgO23q7PmC3cd1RzDQJ0h033EXTkFaf6uPjT5lfp3DZ+o8ziozTVt6wGTosrXs+VE7jJ PXrqVzJncH2e8SZNG6tIDURuDOFlN6urPFYuLn1ESTImc9HlzRnWAppAppMN2GY+rawzKT Nl14G1xOjTuQlDFcgpLlxcekZE6q0KsiaqKIvtBHBwVg8V7DYX4QPdFpGmZ3SVifFQPisN kR4nqaL7gOPU51/bO8PyBPZUGXlOZcJCEtdPZB+1hio8uhl3Jkz8YPuxX5Oa4rQwnFhAo/ efVkG+aeXj8ln1WUEMQSyzdRFb0BEq32iEgrWsJAaH7+9pDqTwNM15lchRMpSA== In-Reply-To: (Andreas Schwab's message of "Thu, 22 Aug 2024 09:09:18 +0200") X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::ba; envelope-from=joseph@ushin.org; helo=out-186.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 06:01:38 -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:323039 Archived-At: Andreas Schwab writes: > On Aug 21 2024, Joseph Turner wrote: > >> Let's say I have a `iso-latin-1'-encoded file "foo.txt" on my local >> filesystem. I upload this encoded file to my hyperdrive by passing the >> filename to curl, which uploads the bytes with no conversion. Then I >> open the "foo.txt" hyperdrive file using hyperdrive.el, which receives >> the contents via curl from the local HTTP server. In the hyperdrive >> file buffer, buffer-file-coding-system should be `iso-latin-1' (right?). > > That depends on the coding system priorities. Since latin-1 cannot be > identified unambiguously, only the priority can distinguish it from > other 8-bit coding systems. Also, if the file contains only ASCII > characters, buffer-file-coding-system will be set to undecided. Thank you! I think you just answered my question to Eli: > What fallback encoding should we use if there's no 'Content-Type' > charset and `set-auto-coding' returns nil? IIUC, there's no foolproof > way to guess the encoding of unknown bytes. Should we use (coding-system-priority-list t) as the final fallback? Joseph