Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nrws0-0004m1-4F for pgsql-novice@arkaria.postgresql.org; Fri, 20 May 2022 07:16:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nrwry-000240-Sg for pgsql-novice@arkaria.postgresql.org; Fri, 20 May 2022 07:16:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nrwry-0001wP-EP for pgsql-novice@lists.postgresql.org; Fri, 20 May 2022 07:16:18 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nrwrr-0008QG-Ou for pgsql-novice@lists.postgresql.org; Fri, 20 May 2022 07:16:17 +0000 Received: by mail-pj1-x1033.google.com with SMTP id t11-20020a17090a6a0b00b001df6f318a8bso10722425pjj.4 for ; Fri, 20 May 2022 00:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aqUMfjENGDBRVLqGE/rQ5d/XeNqDe+dGOuz04J61wsc=; b=G/44dWc68XvoAGU0+my9qtEhip9vlKdT8hCEhevrWtlj3sgukTcFsRuSo38qO6qqFb hJ1XnpMPFw0sdZrt03dZ0NWrc5umSEt1UqIO11SIMm6f2Sf0gy33OwyOXrMwx3FdErOP 7E0aC5hS7T7NWUcAmTBNzT0ZZmSQ+e6FFY10SL2aiSsEU2e5iO3vh4CqDp5UCCQOt9nj v/L+X3TDC026+73aKbAEWzvO9WAvhdZqKCRCqR3vjObdb7d4/3jhpWnTxLq+MfvzKnqc H0lKgwF5+JikQVAC3Ve8yVlbr8ffk03/UQDYIGERPQQd+OJ10RbCGFdTIGiYTgWZKXMS 3PYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aqUMfjENGDBRVLqGE/rQ5d/XeNqDe+dGOuz04J61wsc=; b=ObdpWMyccVD3LqTjweOVfnVhNnwSQOk2SHYqhQcwhajkqwLyme2uXM7jLi0sPZ18Er ljOl13ViFueTfxuSjSBD41hyic3I0Sj/zI4WZImLbh1Chzlx9XxkbHRihQdbtk1zIOHT fTfyj7NoY0otiElIdgsa/6p99WmQ9gTpC3J7Jd1KGT1mlEVa5gsFEZBSirH5D0kvmqNT H4NRWwNbotIiXgbRMTELKc/Yhs3Nx7vncheu2a2CyzH+fbRkSIysFjeYbXCcqsTGosif kATHK/VU+SZIxuQm4EMUyumN0uXTx8GvbLpTuSUVV1YjXXa6FCVCZY0bp0taid59izEG GL6Q== X-Gm-Message-State: AOAM531EAqj7PKU68n8NkaRHgjZqQo533pCTT9WcVcodX5mmkvWYB3gL 3vC7eemSvuF0iKggROQDDXoEKt24c2ae+S1jiMM= X-Google-Smtp-Source: ABdhPJw5KhHqtaXgKHb8tUFOSST+2uRk3TnrLDPyhhWjpOA/Y864/J+T/8hgCFpBlaGQEx6u+jvZLSwJGGiVJbfgcnM= X-Received: by 2002:a17:902:f612:b0:14c:e978:f99e with SMTP id n18-20020a170902f61200b0014ce978f99emr8575616plg.23.1653030970520; Fri, 20 May 2022 00:16:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: mahendrakar s Date: Fri, 20 May 2022 12:45:59 +0530 Message-ID: Subject: Re: Comparing two URL strings To: Alan Hodgson Cc: pgsql-novice@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000ccf65705df6c433c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000ccf65705df6c433c Content-Type: text/plain; charset="UTF-8" Thanks Alan. On Thu, 19 May 2022 at 22:35, Alan Hodgson wrote: > On Thu, 2022-05-19 at 22:23 +0530, mahendrakar s wrote: > > Hi, > I am facing an issue in comparing two urls (below). > 1) "https://domain.org/v1.0/users/test@user.org" > 2) "https://domain.org/v1.0/users/test%40user.org" > > Comparison of the two strings is failing due to mismatch of '%40' and (@) > character even though the both urls are the same. > (gdb) p url > $1 = 0x55d35cfbd1f8 "https://domain.org/v1.0/users/test@user.org" > (gdb) p graph_url > $2 = 0x7ffd82777240 "https://domain.org/v1.0/users/test%40user.org" > > Can you please let me know how to compare these two strings. > One way I could think of is convert both the strings to utf-8 but don't > find an utility function to compare the UTF-8 strings. > > > They aren't multi-byte; converting them to UTF-8 wouldn't change anything. > As is, they are in fact different strings, as "URL" is something only > browsers know about. > > You probably need to urldecode (or encode) them in your programming > language before storing them. > --000000000000ccf65705df6c433c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks Alan.

On Thu, 19 May 2022 at 22:35, Alan Hodgson &l= t;ahodgson@lists.simkin.ca&= gt; wrote:
=
On Thu, 2022-05-19 at 22:23 +0530, mahendrakar s wrote:
Hi,
I am facing= an issue=C2=A0in comparing two urls (below).

= Comparison of the two strings is failing due=C2=A0to mismatch of '%40&#= 39;=C2=A0 and (@) character even though the both urls are the same.
=C2= =A0(gdb) p url
$1 =3D 0x55d35cfbd1f8 "https://domain.org/v1.0/users/= test@user.org"
(gdb) p graph_url
$2 =3D 0x7ffd82777240 "= ;https://domain.org/v1.0/users/test%40user.org"

Can you please let me know how to compare=C2=A0these two = strings.
One way I could think of is convert both the strings to = utf-8 but don't find an utility function to compare the UTF-8 strings.<= /div>


They aren't = multi-byte; converting them to UTF-8 wouldn't change anything. As is, t= hey are in fact different strings, as "URL" is something only bro= wsers know about.

You probably need to urldecode (= or encode) them in your programming language before storing them.
--000000000000ccf65705df6c433c--