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: default charset for text/html selection in X11 Date: Wed, 21 Jun 2023 20:13:21 +0300 Message-ID: <83h6r04u32.fsf@gnu.org> References: <87mt0sg6fc.fsf@gmail.com> 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="15633"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Robert Pluim Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jun 21 19:14:06 2023 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 1qC1PC-0003tf-4r for ged-emacs-devel@m.gmane-mx.org; Wed, 21 Jun 2023 19:14:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC1OO-0002GQ-DZ; Wed, 21 Jun 2023 13:13:16 -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 1qC1OM-0002G2-PV for emacs-devel@gnu.org; Wed, 21 Jun 2023 13:13:14 -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 1qC1OM-0000uQ-Gv; Wed, 21 Jun 2023 13:13:14 -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=yO5l32SufaAU9aKdo4sW4V486PBPuNXXiak6TPK+u9I=; b=lavZBhbe8/xUMPsngQIa JFr0tM70TJHd7sKnm9+6FhxzCVzjZ3dfJ9mkjMgVm5FF4XJZd51pKyJNBMHnW+Lr+BeiE9C6fdSKF wSUnHsAz2N5pQaOof5StlIAjuxMX34EPN/c6BTEdGE0AwTfxzmGhV8V1CgJXOwp3s9/jvYxvCHiKx mrt3dumzKCiAlrR1byrsHhqkHkjgpKT2nQ5ehUx/0hSBkchkmQgUYxx4KXna3AZvH6nKq8LcSKg9Q /ZDItuj8P66Bvwhb7A1eBxS+O43tnAush8HN63tWPqpJwDtmNGbRszXWfN8Sju/Z9XzJA7hkMgaBl epKq8pm+AmG6UA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC1OL-00007W-JI; Wed, 21 Jun 2023 13:13:14 -0400 In-Reply-To: <87mt0sg6fc.fsf@gmail.com> (message from Robert Pluim on Wed, 21 Jun 2023 17:51:19 +0200) 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:307117 Archived-At: > From: Robert Pluim > Date: Wed, 21 Jun 2023 17:51:19 +0200 > > (defun html-mode--html-yank-handler (_type html) > (save-restriction > (insert html) > (ignore-errors > (sgml-pretty-print (point-min) (point-max))))) > > insert any codepoints > 127 as their constituent raw bytes > instead, eg U+A0 ends up as \xc2\xa0 in the buffer. > > I *think* it should be OK to assume utf-8 here, and thus do: > > (defun html-mode--html-yank-handler (_type html) > (save-restriction > (insert (decode-coding-string html 'utf-8 t)) > (ignore-errors > (sgml-pretty-print (point-min) (point-max))))) > > but I canʼt find a normative reference for that (if this was http, the > default charset would be iso-8859-1, but this isnʼt http). How about looking in the sources of Chromium? If the encoding doesn't have to be UTF-8, forcing UTF-8 there might not be the best idea.