From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: How to escape a string which will be added as a ?key=value parameter in a url? Date: Tue, 29 Sep 2015 11:25:33 +0600 Message-ID: References: <87mvw7r5xo.fsf@mbork.pl> <87fv1zipgh.fsf@web.de> <87d1x2oxue.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1443520968 3667 80.91.229.3 (29 Sep 2015 10:02:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Sep 2015 10:02:48 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 29 12:02:42 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zgrk9-0008Nl-LK for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Sep 2015 12:02:41 +0200 Original-Received: from localhost ([::1]:49227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zgrk9-00013r-3o for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Sep 2015 06:02:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37910) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgnQJ-0004mN-Es for help-gnu-emacs@gnu.org; Tue, 29 Sep 2015 01:25:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgnQI-0000ut-CF for help-gnu-emacs@gnu.org; Tue, 29 Sep 2015 01:25:55 -0400 Original-Received: from mail-la0-x232.google.com ([2a00:1450:4010:c03::232]:33049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgnQI-0000u5-4A for help-gnu-emacs@gnu.org; Tue, 29 Sep 2015 01:25:54 -0400 Original-Received: by lahh2 with SMTP id h2so183581063lah.0 for ; Mon, 28 Sep 2015 22:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=RhxbkiUPvQHg4OcuFdSZ2jC6IddcFMoN7GKar6S+gCE=; b=CqE+hfHhDiaah+dGMOKhTi47o9F469KCJA5x6MHJ/Ox5OdhUoMdvUGgbtt0VbYKFDz +5vFiMcDfCDTGkUFbSf3y6uJW6hwKFi+0D05cTxGaDkLllH0InzdbPUD09FV4dIVxAY0 xppAuYBd6SLU4bGGTSR8FsKTqblzz0MI20mONzxj6bFKtO8rmfUm2ROdYa1bEgfCW3Jv HBnP7QxFiSAE1fthz3Zg6EtGSkkf+PSSj6YKQ9z/U+hrSSCm1C4RJ34c8azbaX9fZf0p y6xA1R3Dl//+mt+XSCVzbB8/T79dPThRpKqOiEyn/kgrrQ+GWeC7og4oPOIVidP2lKm3 Ow8w== X-Received: by 10.152.37.135 with SMTP id y7mr4090095laj.110.1443504352656; Mon, 28 Sep 2015 22:25:52 -0700 (PDT) Original-Received: by 10.25.156.131 with HTTP; Mon, 28 Sep 2015 22:25:33 -0700 (PDT) In-Reply-To: <87d1x2oxue.fsf@debian.uxu> X-Google-Sender-Auth: 9gkAtTFb4PXBiXUXZRVDP8ccLaM X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::232 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107397 Archived-At: On Tue, Sep 29, 2015 at 6:47 AM, Emanuel Berg wrote: > Yuri Khan writes: > >> Blindly substituting the value for %s in a format >> string, as Emanuel suggests, is definitely not the >> right thing. > > Here is another example: > http://user.it.uu.se/~embe8573/conf/emacs-init/isbn.el > > ...and observe what cool things you can do outside the > realm of schoolbook scholasticism! Look, Emanuel, we all know string concatenation works when you absolutely know that your substituted values do not contain any funny characters. Marcin specifically asked for a function that is robust in presence of characters which are conventionally used as key/value/pair separators in URI query strings. See also a small excerpt from the biography of one boy named Robert: https://xkcd.com/327/