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.help Subject: Re: Multiple encodings in one file Date: Mon, 29 Apr 2024 10:22:15 +0300 Message-ID: <86plu8skew.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28843"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 29 09:23:36 2024 Return-path: Envelope-to: geh-help-gnu-emacs@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 1s1LMO-0007GJ-DK for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 29 Apr 2024 09:23:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1LLc-0002ch-FA; Mon, 29 Apr 2024 03:22:48 -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 1s1LLZ-0002T0-Ik for help-gnu-emacs@gnu.org; Mon, 29 Apr 2024 03:22:45 -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 1s1LLZ-0005Q8-8F for help-gnu-emacs@gnu.org; Mon, 29 Apr 2024 03:22:45 -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=IR85wUO5cy6t0Xzb15hPUJO8sDkc35VPJwu6OwKO3us=; b=R2ZQgVij478d eTs7ydaOsjP6uHcdePc2QkMu6kwJJXq1hhp+COFMSfmKr/I41uMMmFOHdWMdjtNt6x73GKcmUYMQJ VVwl7XnnU8A2KvBOIR+2AnUqR9WnpQLA8RzZG/Kiv4FXXJ5Zcn3DdLmhCSLOhDDGiNSWPVjGjmwgx Mwwj7TwOsZcYrhpFV88EwChlWj3RS3VJbAsnjoSzaTaiiwLdHTLaJdpZLibZevuHXPrOex6PGWc+f JlS8vWUChLw3khAIq1g1PQDT+/FjgGgI/ozxj3P4HK9PnK6iLaZkb3/UW6817IZdLTZ2K7ZVMqM/o SJv96FtpcFw6WJXU4UEZaw==; In-Reply-To: (JLambert@MissouriState.edu) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:146498 Archived-At: > From: "Lambert, Joshua D" > Date: Mon, 29 Apr 2024 04:20:54 +0000 > msip_labels: > > Question: If I open a file that uses one encoding in one part of the file and another encoding in another part of the file, and also uses multiple character sets, can I edit a small part of it in Emacs, using UCS (Unicode), without Emacs changing the rest of the file? No. The built-in machinery for encoding and decoding file's contents when visiting or saving files assumes the same encoding for the entire file. To support files whose different parts are encoded differently, you will need to decode each part "by hand": visit the file literally, then loop over each part and decode each part using decode-coding-region. When saving, do the opposite.