public inbox for [email protected]  
help / color / mirror / Atom feed
From: Alan Hodgson <[email protected]>
To: [email protected]
Subject: Re: Comparing two URL strings
Date: Thu, 19 May 2022 10:05:36 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CABkiuWpNDO16QXUoC93WMmjgco3WfzfvuppWe4udSZ4N2d3DqQ@mail.gmail.com>
References: <CABkiuWpNDO16QXUoC93WMmjgco3WfzfvuppWe4udSZ4N2d3DqQ@mail.gmail.com>

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/[email protected]";
> 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/[email protected]";
> (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.


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Comparing two URL strings
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox