From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: How to get buffer byte length (not number of characters)? Date: Fri, 23 Aug 2024 15:38:13 +0300 Message-ID: <865xrrquru.fsf@gnu.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> <87ttfcl8bn.fsf@ushin.org> <86zfp4qtxn.fsf@gnu.org> <878qwnj3j0.fsf@ushin.org> <86frqvrabj.fsf@gnu.org> <87le0nfzuv.fsf@ushin.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33380"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, schwab@suse.de, adam@alphapapa.net To: Joseph Turner Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 23 14:39: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 1shTZR-0008VH-0U for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Aug 2024 14:39:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shTZB-0005rj-NM; Fri, 23 Aug 2024 08:38: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 1shTZ8-0005rU-9D for emacs-devel@gnu.org; Fri, 23 Aug 2024 08:38:55 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1shTZ6-0002AB-Fj; Fri, 23 Aug 2024 08:38:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=idfEv8V5OMLglde0r0SsUAxrGIisSZFeqWLFA2ysHi4=; b=JO19xOgtYMDPSPf5D93H QWBmMRbbr/NU8hLhWrLpcXZo2naLA0VGAS9+5sC6iuPY2lmJ471Fud7fuTEh8vDHQ71bwVKccCCnF IS73d0Q3IJszpuwPHbGy8wQ5KcumMLG89wxVdjhi+TEoWpVAsrdOchjgovgOYUtKKA24IBW9e0bbF KBo+F7PjGv8CuTM30WpzZEH7XGaiDbvc5XIDLDbs0UeCWbt2oViFJope781rQS2ZGqGno6+cJ8/2V 0v0zBtWPH9sZ2Hsq1sRDmfdYk6yJ1BTz5cSzqaPxCzE4U5nh78rYBSLcJkCjnI6QqsovC7b0QklaG x4t+rHOUFcpdMQ==; In-Reply-To: <87le0nfzuv.fsf@ushin.org> (message from Joseph Turner on Fri, 23 Aug 2024 00:43:52 -0700) 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:323082 Archived-At: > From: Joseph Turner > Cc: emacs-devel@gnu.org, schwab@suse.de, adam@alphapapa.net > Date: Fri, 23 Aug 2024 00:43:52 -0700 > > I'm surprised that > > (with-temp-buffer > (insert "你好") > (set-buffer-file-coding-system 'chinese-big5) > (car (find-coding-systems-region (point-min) (point-max)))) > > returns 'utf-8 and not 'chinese-big5. What does coding-system-priority-list returns in your case? > Are the codings intended to be > ordered by priority? Yes. > If so, should buffer-file-coding-system be at the front of the list > if it's safe? How do you know it's safe? If your application needs to prefer buffer-file-coding-system, then you should see if buffer-file-coding-system is a member of the list returned by find-coding-systems-region, and if so, use that.