From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: fixing url-unhex-string for unicode/multi-byte charsets Date: Fri, 06 Nov 2020 09:59:02 -0500 Message-ID: References: <20201106074742.jq3h4uujm7oce7af@E15-2016.optimum.net> <83wnyy9akw.fsf@gnu.org> <20201106102756.e2ctvpjruenatud5@E15-2016.optimum.net> <83pn4q8zdz.fsf@gnu.org> <20201106122846.unoizvad53blgncf@E15-2016.optimum.net> <83lffe8v92.fsf@gnu.org> 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="12431"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Boruch Baum , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 06 16:00:54 2020 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 1kb3EU-000366-BB for ged-emacs-devel@m.gmane-mx.org; Fri, 06 Nov 2020 16:00:54 +0100 Original-Received: from localhost ([::1]:37986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kb3ET-0005vN-Ci for ged-emacs-devel@m.gmane-mx.org; Fri, 06 Nov 2020 10:00:53 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kb3Cp-0004Wj-OU for emacs-devel@gnu.org; Fri, 06 Nov 2020 09:59:11 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:61754) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kb3Co-0007Fd-93; Fri, 06 Nov 2020 09:59:11 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 08109440BA3; Fri, 6 Nov 2020 09:59:09 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 816D54407F9; Fri, 6 Nov 2020 09:59:03 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1604674743; bh=ehXk7HveH4OYHuU1YF99upyA54Lo+LnNM4nsGUDWLLE=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=UlgJB/HXZKxcTqk+8Czpz0jiOZQpodr3L8nlYcu0JMec37iXFjHYIHgRMSsf4Eo8B J+LLySjN/LqB9o/7YF4X5fYls5FbHTQvcjc1ADXE3ATIjEBUgz68Pbjf6IMCYV0kwg 2yuctEMWej8T4lfyb6MO5GYJ8z2Zf9E1TRHuy2E4QDcUOS2SIp8VmEuqU9UsRx66yz ssmm/cNYfRoypH2qdyh47psMrUYeAQhaOvI1BU5uTRRzWzhmXcznWiUZXxUY8ZTcOW OIhl/hETjNkyDIeJSmpr/LplSMfUrcvFxf9UWyErN7OnZz60E3HWfIQc1IhYlt3qi/ bRKfwMogMk2Rg== Original-Received: from alfajor (unknown [157.52.9.240]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1CD251202A8; Fri, 6 Nov 2020 09:59:03 -0500 (EST) In-Reply-To: <83lffe8v92.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 06 Nov 2020 15:34:01 +0200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/06 08:56:47 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:258822 Archived-At: > (dolist (str '("hello%20world" > "%d7%a9%d7%9c%d7%95%d7%9d%20%d7%a2%d7%95%d7%9c%d7%9d")) > (insert (decode-coding-string (url-unhex-string str) > (or file-name-coding-system > default-file-name-coding-system)) > "\n")) > > The result of evaluating this is two lines inserted into the current > buffer: > > hello world > =D7=A9=D7=9C=D7=95=D7=9D =D7=A2=D7=95=D7=9C=D7=9D > > If this doesn't work for you, or if you tried something slightly > different, I'd like to hear the details, perhaps there's some > subtlety I'm missing. My guess is that his `file-name-coding-system` is set to something different from utf-8. [ BTW, I wouldn't be surprised to hear that the Freedesktop spec documents that the file names in the Trash should use utf-8, in which case the code should hard-code utf-8 rather than use `file-name-coding-system` ;-) ] > As a rule of thumb, any Lisp code that needs to do something with a > string and does that by inserting it into a temporary buffer and > working on that instead, should raise the "missing primitive" alarm. Tho only for reasonably trivial amounts of "working on that" ;-) Stefan