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:34:09 +0300 Message-ID: <867cc7quym.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> <87plpzg05e.fsf@ushin.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18306"; 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:35:33 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 1shTVs-0004cq-Nn for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Aug 2024 14:35:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shTUq-000416-Bn; Fri, 23 Aug 2024 08:34:28 -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 1shTUd-0003y9-1O for emacs-devel@gnu.org; Fri, 23 Aug 2024 08:34:17 -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 1shTUa-0001Lk-SF; Fri, 23 Aug 2024 08:34:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=15icA3oEmAN/Co2G7Q3kAfkAnvluGvpVLvb23WHnkPI=; b=ruUEZsJurvZu nv2DjsrC6HsM1o4jkSititRpZMnAx13u309U36E/H2P0RuXDSdNO7jCQc6hoCTf/T8IF1BTPqXz0U A/SJtesFj7oBBJFS+2EcdngrDZ3TtBYlyGl5VBezXd5HzVPwYBFf4Nyhwax6H85mskYhlKRjw24br o3CSJKPauLI/xJIPcpNdWh7FE2k5nICubSZ41prMJkPSH5EOBT7P+uOvtq6aRX+L8NtzMZJ8kq2ia SWiaD6Ib9yK9ZrHoz1Uc1jT5ucSwZ2DHGJY4RlRSWGM4yUUNXFyAzHkXFzh02pJvjXd8mVWcw4EUE flyBQXf+Otcnq4z9Lf9Pbg==; In-Reply-To: <87plpzg05e.fsf@ushin.org> (message from Joseph Turner on Fri, 23 Aug 2024 00:37:33 -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:323080 Archived-At: > From: Joseph Turner > Cc: emacs-devel@gnu.org, schwab@suse.de, adam@alphapapa.net > Date: Fri, 23 Aug 2024 00:37:33 -0700 > > Eli Zaretskii writes: > > >> How do we encode if find-coding-systems-region returns '(undecided)? > > > > Use buffer-file-coding-system. > > > > If this is an interactive command, you could also use > > select-safe-coding-system, which calls find-coding-systems-region > > internally, and also has complex logic for finding suitable callbacks > > and asking the user to select an encoding if it fails to find > > something suitable. But this is not appropriate in non-interactive > > code. > > Thank you! If both find-coding-systems-region and > buffer-file-coding-system are undecided, then is it safe to fallback to > utf-8? Yes.