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: master 396355f: Re-fix charset issues when yanking non-plain-text elements Date: Thu, 11 Nov 2021 13:19:52 +0200 Message-ID: <83mtmb0wiv.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5552"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 11 12:20:57 2021 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 1ml88X-0001DT-E1 for ged-emacs-devel@m.gmane-mx.org; Thu, 11 Nov 2021 12:20:57 +0100 Original-Received: from localhost ([::1]:58814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ml88W-0001gd-E0 for ged-emacs-devel@m.gmane-mx.org; Thu, 11 Nov 2021 06:20:56 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ml87X-0000EF-Rj for emacs-devel@gnu.org; Thu, 11 Nov 2021 06:19:55 -0500 Original-Received: from [2001:470:142:3::e] (port=49242 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ml87X-0003WW-Fn; Thu, 11 Nov 2021 06:19:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Subject:To:From:Date:mime-version:in-reply-to: references; bh=wDsGdEeCz2Eu6ZYhn2+bVr1AlUGqGiNzmW8fb+eGuAc=; b=K95gMnr8Pefi4u xIQHTQlqchRpuJ7MFoylhTmDMwN5WPDwUOy7cxA9oNu2EYeZ+CWOa+af8r7zGdAg+f5hi792Q8tIr kAVGX6TLN1Yqtaw9lDvzN7DczL4QUN8IV1xZDbhJZqlOC8gNWsntG0olK/F6s+GXAiN83Jm5B4Jia 9gvxX4LVteThjeIm3S8u+q+EuDEY6fA9pGa+S1vdN40Tv9vXpXRI9T9uRybuIDcGeih1syaK4U/Hi chts9giySJt9SxtItC1rRHF9KgUpAtUPMJ92zDWHb7RjyxdNIzQA6HqyG5EDtEclDIbJ6vHJnIdpF gE8KOUHeRrSj6buiJlPQ==; Original-Received: from [87.69.77.57] (port=4017 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 1ml87X-0006P1-0P; Thu, 11 Nov 2021 06:19:55 -0500 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" Xref: news.gmane.io gmane.emacs.devel:279245 Archived-At: > (let ((data (gui-backend-get-selection (or type 'PRIMARY) > (or data-type 'STRING)))) > (when (and (stringp data) > - (setq data-type (get-text-property 0 'foreign-selection data))) > + ;; If this text property is set, then the data needs to > + ;; be decoded -- otherwise it has already been decoded > + ;; by the lower level functions. > + (get-text-property 0 'foreign-selection data)) The old code took the data-type from the value of the foreign-selection property, but now we disregard that. Is that on purpose? > + ;; 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)))) Did you really need the explicit call to detect-coding-string? AFAIR, decode-coding-string does that automatically if needed. Did that fail in some case?