From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: default charset for text/html selection in X11 Date: Thu, 22 Jun 2023 11:07:45 +0200 Message-ID: <87edm3g90e.fsf@gmail.com> References: <87mt0sg6fc.fsf@gmail.com> <875y7g2u26.fsf@yahoo.com> <87pm5o182d.fsf@yahoo.com> <87ilbgeza0.fsf@gmail.com> <878rcc0vzs.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37119"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 22 11:08:51 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 1qCGJ9-0009XR-8u for ged-emacs-devel@m.gmane-mx.org; Thu, 22 Jun 2023 11:08:51 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCGIC-0002bj-09; Thu, 22 Jun 2023 05:07:52 -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 1qCGIA-0002bT-It for emacs-devel@gnu.org; Thu, 22 Jun 2023 05:07:50 -0400 Original-Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qCGI9-0008BQ-2I for emacs-devel@gnu.org; Thu, 22 Jun 2023 05:07:50 -0400 Original-Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3111cb3dda1so8040588f8f.0 for ; Thu, 22 Jun 2023 02:07:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687424867; x=1690016867; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=13d7JErxE6DSmGk1zmP4fBqKWakLTqfBYLy6rlmT1dM=; b=ODg+2g1xxwKFAHFZvq0v8Mr2ISQZZy46nuqZRBxQITvpwg81FFOMIkfX7UoHuJ/5YL lf4JQ6BOOqkOchp0CUek+iqk7tNpXVUY1dVztq1K8/VhFwYgj7FCegS87Q1y1mZA1gms 6zN46v5IapNvXi8OJ+/usVkgBWbt/bJ7S766WxU0qqRTc8oP2NVAeJ9n3mcquCVB7TVR DVSS/THeXbYnDi3LKx0KeF4TVSNtKdkuUQWm7sjtsbFPChScJogG1BV7xpa6pDLexRPn jkKVEreOp8zyuEay9C4OVBeVDDHQY2EKn4a/VtnBDN8vb8l0GecFzLYpxgD0VWQX92le 8WRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687424867; x=1690016867; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=13d7JErxE6DSmGk1zmP4fBqKWakLTqfBYLy6rlmT1dM=; b=K5+FQqxi9Nd54R//rasnTTmVz7vTeXfLWf5tQtxloWc6FElRN2JN/O8cNoGxs/1yoh umu/9iYfYz94QqOkwJddAeGXi5mYkSky5ssIPKbbqF7lzSaihpsy8kRHCoR5QlUd0tCd rS3EeDFXVw6K9Up851Uj71g7NSZ/xWdK8M0GXjrjNrGTPgJmQr9fSus2wXBecJNOVe1R hKSCU08xlAfhxFhIS6qi2YUXDG3/W6MSzIkowDVPuzglGjKN827dANvE3RgntwzpvZ0w qEtqy4so2MQfkEqLFymev9zmwEgyTsxDVY3sggKKtA1G/mVstzq08LMd3s6O4QW4eb8Z Vpug== X-Gm-Message-State: AC+VfDxLGaXMSCzv9z8S5GqA956g8TiF32Vy1S0Bk1pGErQexDayIetl XdYE75FCOj5zlLznXJogaVLDydKp8vM= X-Google-Smtp-Source: ACHHUZ6dVkINicGfe75RjeWeqlT69K8KnOMgYV6tAt20xwH8N1kNlVLk7zDhkL5jl1PxnN8S+BJyAw== X-Received: by 2002:adf:f9c6:0:b0:30f:ce80:e465 with SMTP id w6-20020adff9c6000000b0030fce80e465mr19437897wrr.50.1687424866927; Thu, 22 Jun 2023 02:07:46 -0700 (PDT) Original-Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id d2-20020adff842000000b00312793cc763sm6601813wrq.15.2023.06.22.02.07.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 02:07:46 -0700 (PDT) In-Reply-To: <878rcc0vzs.fsf@yahoo.com> (Po Lu's message of "Thu, 22 Jun 2023 15:57:59 +0800") Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=rpluim@gmail.com; helo=mail-wr1-x42f.google.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:307127 Archived-At: >>>>> On Thu, 22 Jun 2023 15:57:59 +0800, Po Lu said: Po Lu> Robert Pluim writes: >>>>>>> On Thu, 22 Jun 2023 11:37:14 +0800, Po Lu = said: >>=20 >> Po Lu> Po Lu writes: >> >> What is the type of the string? IOW, what's >> >>=20 >> >> (get-text-property html 'foreign-selection) >>=20 >> Po Lu> (get-text-property 0 html 'foreign-selection), of course. So= rry about >> Po Lu> the confusion. >>=20 >> (get-text-property 0 'foreign-selection html) =3D> STRING >>=20 >> but it=CA=BCs definitely a utf-8 string, not iso-latin-1. Po Lu> Would you please report this as a bug, to the Chromium developer= s? Po Lu> That is, if: Po Lu> (x-get-selection-internal 'CLIPBOARD 'text/html) Po Lu> returns a string of the same type. It does. Po Lu> The ICCCM clearly states that: Po Lu> STRING as a type or a target specifies the ISO Latin-1 charact= er set Po Lu> plus the control characters TAB (octal 11) and NEWLINE (octal = 12.) Po Lu> The spacing interpretation of TAB is context dependent. Other= ASCII Po Lu> control characters are explicitly not included in STRING at the Po Lu> present time. I=CA=BCm not about to contradict the ICCCM, but `gui-get-selection' does the following ;; Guess at the charset for types like text/html ;; -- it can be anything, and different ;; applications use different encodings. ((string-match-p "\\`text/" (symbol-name data-type)) (decode-coding-string data (car (detect-coding-string data)))) ;; Do nothing. I took a closer look, and `yank-media' does the wrong thing, but `(yank-media-types t)' and selecting "text/html" does the right thing. The difference is that the former uses `gui-backend-get-selection', and the latter uses `gui-get-selection', and thus does the auto-detection. Robert --=20