public inbox for [email protected]
help / color / mirror / Atom feedComparing two URL strings
3+ messages / 2 participants
[nested] [flat]
* Comparing two URL strings
@ 2022-05-19 16:53 mahendrakar s <[email protected]>
2022-05-19 17:05 ` Re: Comparing two URL strings Alan Hodgson <[email protected]>
0 siblings, 1 reply; 3+ messages in thread
From: mahendrakar s @ 2022-05-19 16:53 UTC (permalink / raw)
To: pgsql-novice <[email protected]>
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.
Thanks,
Mahendrakar.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Comparing two URL strings
2022-05-19 16:53 Comparing two URL strings mahendrakar s <[email protected]>
@ 2022-05-19 17:05 ` Alan Hodgson <[email protected]>
2022-05-20 07:15 ` Re: Comparing two URL strings mahendrakar s <[email protected]>
0 siblings, 1 reply; 3+ messages in thread
From: Alan Hodgson @ 2022-05-19 17:05 UTC (permalink / raw)
To: [email protected]
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Comparing two URL strings
2022-05-19 16:53 Comparing two URL strings mahendrakar s <[email protected]>
2022-05-19 17:05 ` Re: Comparing two URL strings Alan Hodgson <[email protected]>
@ 2022-05-20 07:15 ` mahendrakar s <[email protected]>
0 siblings, 0 replies; 3+ messages in thread
From: mahendrakar s @ 2022-05-20 07:15 UTC (permalink / raw)
To: Alan Hodgson <[email protected]>; +Cc: [email protected]
Thanks Alan.
On Thu, 19 May 2022 at 22:35, Alan Hodgson <[email protected]> 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/[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.
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2022-05-20 07:15 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19 16:53 Comparing two URL strings mahendrakar s <[email protected]>
2022-05-19 17:05 ` Alan Hodgson <[email protected]>
2022-05-20 07:15 ` mahendrakar s <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox