GNU logs - #79966, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#79966: 31.0.50; iso-8859-1 usage by selection code under Wayland
Resent-From: Robert Pluim <rpluim@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 08 Dec 2025 14:20:01 +0000
Resent-Message-ID: <handler.79966.B.17652035765563 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 79966
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 79966 <at> debbugs.gnu.org
Cc: Po Lu <luangruo@HIDDEN>
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.17652035765563
          (code B ref -1); Mon, 08 Dec 2025 14:20:01 +0000
Received: (at submit) by debbugs.gnu.org; 8 Dec 2025 14:19:36 +0000
Received: from localhost ([127.0.0.1]:45689 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vSc5P-0001Rc-P3
	for submit <at> debbugs.gnu.org; Mon, 08 Dec 2025 09:19:36 -0500
Received: from lists.gnu.org ([2001:470:142::17]:35660)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rpluim@HIDDEN>) id 1vSc5M-0001R6-Ns
 for submit <at> debbugs.gnu.org; Mon, 08 Dec 2025 09:19:33 -0500
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 <rpluim@HIDDEN>) id 1vSc59-0003Gg-R9
 for bug-gnu-emacs@HIDDEN; Mon, 08 Dec 2025 09:19:20 -0500
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 <rpluim@HIDDEN>) id 1vSc57-0005sI-Tr
 for bug-gnu-emacs@HIDDEN; Mon, 08 Dec 2025 09:19:19 -0500
Received: by mail-wr1-x42f.google.com with SMTP id
 ffacd0b85a97d-42e2e77f519so2882926f8f.2
 for <bug-gnu-emacs@HIDDEN>; Mon, 08 Dec 2025 06:19:17 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1765203555; x=1765808355; darn=gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=QU7umtdQSicDpxF7SVZNvKZzvLezzog1OZI7yZZ6X2Y=;
 b=l8P63rG25j25T1HY/MZnBCHBIE27fXi7koESq2A0DSCszIJAeFS+l0dlsH8+gfUl6h
 biIa3EtYuHBYpHK/xvePTHijmrIfHAVy7ympHQFKwhoAIBqFDOLXfn2IQS/FYXw064Et
 +EiA0AQK+MRwNNBomQGmxYgQuH8a+uhDSerjAsXfm+M9VCnWfNqNvKqJnE2G9hI0Is55
 D7b0y7WIt0eCJSGrQpIj7dN76/3AEpO9R8LPsCbv7zX3eFtbikN25YGNDz+pI/NumGlk
 gktDea0erbSEsSPfuoS2HI/3VN3ERLWDUoLeK1qCbVf4kzw7ZwECwPviC+an6cgWv7MO
 7OlA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1765203555; x=1765808355;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=QU7umtdQSicDpxF7SVZNvKZzvLezzog1OZI7yZZ6X2Y=;
 b=g3e96oN5v7eYuz/Wy7sM8XrHt76t8wapVti4ob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762mr8218299f8f.17.1765203555233; 
 Mon, 08 Dec 2025 06:19:15 -0800 (PST)
Received: from rlsb ([2a01:e0a:3f3:fb50:5234:8d9b:abea:a9f3])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-42f7d353be1sm25139343f8f.39.2025.12.08.06.19.14
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 08 Dec 2025 06:19:14 -0800 (PST)
From: Robert Pluim <rpluim@HIDDEN>
Date: Mon, 08 Dec 2025 15:19:14 +0100
Message-ID: <87v7ihjbtp.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=2a00:1450:4864:20::42f;
 envelope-from=rpluim@HIDDEN; 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 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)


This is a pgtk build of master, running under Wayland, no XWayland is
involved.

This arose from
<https://emacs.stackexchange.com/questions/85255/encoding-issue-with-pgtk-b=
uild-on-wayland-umlauts-dont-reach-chromium/85276#85276>

Chromium is requesting the contents of the clipboard using the 'TEXT
type. The buffer and the clipboard contain "=C3=AB". Emacs ends up in
`xselect--encode-string', where it decides to use 'iso-8859-1' to
encode the string, which Chromium then does not understand, and we get
mojibake.

Forcing `xselect--encode-string' to use 'utf-8 for 'TEXT results in
Chromium inserting the correct text, but I don=CA=BCt know if that is the
correct fix. Wayland appears to assume utf-8 for text, but I=CA=BCve failed
in finding a definitive reference for that.

(based on its docstring, setting `selection-coding-system' to 'utf-8
should have fixed it, but that=CA=BCs ignored, since (coding-system-type
'utf-8) is not 'charset.)

The following patch fixes it for me, but comments from someone more
knowledgeable are welcome. It=CA=BCs possible it will fail horribly when
running a pgtk build under X or XWayland, but I=CA=BCve decided not to
think about that.

diff --git a/lisp/select.el b/lisp/select.el
index 59eedc79263..59fd0650ba5 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -598,7 +598,8 @@ xselect--encode-string
 	  ;; (see ns_string_to_pasteboard_internal in nsselect.m).
 	  (when (eq type 'TEXT)
 	    (cond
-	     ((featurep 'ns)
+             ((or (featurep 'ns)
+                  (featurep 'pgtk))
 	      (setq type 'UTF8_STRING))
 	     ((not (multibyte-string-p str))
 	      (setq type 'C_STRING))

In GNU Emacs 31.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version
 3.24.49, cairo version 1.18.4) of 2025-12-02 built on rlsb
Repository revision: f762ce48d56534f3130470ebae7e276f707d51aa
Repository branch: master
System Description: Debian GNU/Linux 13 (trixie)

Configured using:
 'configure --with-pgtk'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Robert
--=20




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 8 Dec 2025 16:38:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 08 11:38:30 2025
Received: from localhost ([127.0.0.1]:47556 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vSeFq-0001cv-3e
	for submit <at> debbugs.gnu.org; Mon, 08 Dec 2025 11:38:30 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:55260)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>)
 id 1vSeFm-0001cT-FB; Mon, 08 Dec 2025 11:38:27 -0500
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 <eliz@HIDDEN>)
 id 1vSeFh-0002eC-2P; Mon, 08 Dec 2025 11:38:21 -0500
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=bLpLonqvy7rcqLxmOrq6x7HsxyqZI3mlR2iFv/4p6bk=; b=NsK4VFW+51Lz7W+7+Lyv
 oR750XLPRPF/uyWS4xR+dk3/oWxjMxCla0Nlvdcru94Zf1BPmhTfhA616xTX/d8Mzim3u1ZbO67/j
 UspD90wWKJoaMCrlfgO8aCnHM9LWQkFAhEengyj6Piimnew3nVGovi1qCs/WB+TUKUNOIvNwGFen4
 o0PfJvhGZbJVEJyVIMNY8gjiXWzScEuIcImRMxj4+xYSN/4Oba3ybeVWtfkZ8n/GVK26ZE4lIrwBx
 v3WUuEZHhgApmPcr9krWH+DNens13JZ5muyULSm8Ay+nZ7uWQFane63wt/A9giprU1mqubPlFLVNZ
 OKb9635EZ9Z3iw==;
Date: Mon, 08 Dec 2025 18:38:14 +0200
Message-Id: <86ms3tszd5.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Kamphausen <ska2342@HIDDEN>, Robert Pluim <rpluim@HIDDEN>
In-Reply-To: <CA+0DxOi5Gh7YvSFdy6few89ek7f6VUMzqhOBUoOYJrD-+-mAGw@HIDDEN>
 (message from Stefan Kamphausen on Mon, 8 Dec 2025 14:43:13 +0100)
Subject: Re: bug#79967: 30.1;
 Pure Gtk Build Uses Wrong Encoding for Sending to Clipboard (Chromium
 only?)
References: <CA+0DxOi5Gh7YvSFdy6few89ek7f6VUMzqhOBUoOYJrD-+-mAGw@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: control
Cc: Po Lu <luangruo@HIDDEN>, 79967 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

merge 79967 79966
thanks

> From: Stefan Kamphausen <ska2342@HIDDEN>
> Date: Mon, 8 Dec 2025 14:43:13 +0100
> 
> Dear Emacs Bug Squashers,
> 
> My problem is that text with umlauts pasted /only/ from Emacs /only() to
> Chromium gets garbled: "oö aä uü" becomes "o� a� u�" 
> - Verified with hexdump(and C-u C-x =) that the char in buffer in Emacs
> and in the file is actually UTF-8.
> 
> - I can paste from Emacs into Firefox, Kate, terminals, Thunderbird,
> Libreoffice and others without any problems.
> 
> - I can past into Chromium from all those applications without any
> problems.
> 
> - Yes, Chromium replaces the characters with REPLACEMENT
> CHARACTERs. Copy-and-pasting from there continues with the
> replacement character. 
> 
> - If I edit the clipbuffer in the KDE Plasma clipboard util – e.g. add a
> space and save the new clip –, I can paste into Chromium without any
> problems.
> 
> - Verified with emacs -q that it's not connected to my settings.

This seems a duplicate of bug#79966, so I'm merging them.

> 
> I posted this on Stackexchange earlier:
> https://emacs.stackexchange.com/questions/85255/encoding-issue-with-pgtk-build-on-wayland-umlauts-dont-reach-chromium
> 
> 
> My environment:
> 
> - Emacs 30.1 pgtk (switched to this because of the abysmal performance
> of windows resizing on Wayland that literally takes 10 seconds and
> longer to change the size of a window.) 
> 
> - Wayland
> 
> - Kubuntu 25.10
> 
> - KDE Plasma 6.5.3
> 
> - Kernel 6.17.0.6
> 
> - Shell env: LANGUAGE=de_DE:en_US
> 
> - Shell env: LANG=en_US.UTF-8

Thanks.





Last modified: Mon, 8 Dec 2025 16:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.