URL Decoding

Started by Arnaud Lesauvageover 19 years ago4 messagesgeneral
Jump to latest
#1Arnaud Lesauvage
thewild@freesurf.fr

Hi List !

I am looking for an easy URL decoding function.
I thought about using regexp_replace, but I cna't get it to
work :

SELECT regexp_replace('foo%B5bar', '%(..)', '\x\\1' , 'g');

'fooxB5bar'

I wanted to replace %BE with the character \xB5 (�, I
think), but of course I am doing this wrong...
Is there a simple way t odo this ?

Thanks a lot !

--
Arnaud

#2Tino Wildenhain
tino@wildenhain.de
In reply to: Arnaud Lesauvage (#1)
Re: URL Decoding

Arnaud Lesauvage schrieb:

Hi List !

I am looking for an easy URL decoding function.
I thought about using regexp_replace, but I cna't get it to work :

SELECT regexp_replace('foo%B5bar', '%(..)', '\x\\1' , 'g');

'fooxB5bar'

I wanted to replace %BE with the character \xB5 (�, I think), but of
course I am doing this wrong...
Is there a simple way t odo this ?

I was simply using a stored function using pl/pythonu with
urllib (split and unquote). Works flawlessy :-)

Regards
T.

#3Arnaud Lesauvage
thewild@freesurf.fr
In reply to: Tino Wildenhain (#2)
Re: URL Decoding

Tino Wildenhain a �crit :

Arnaud Lesauvage schrieb:

Hi List !

I am looking for an easy URL decoding function.
I thought about using regexp_replace, but I cna't get it to work :

SELECT regexp_replace('foo%B5bar', '%(..)', '\x\\1' , 'g');

'fooxB5bar'

I wanted to replace %BE with the character \xB5 (�, I think), but of
course I am doing this wrong...
Is there a simple way t odo this ?

I was simply using a stored function using pl/pythonu with
urllib (split and unquote). Works flawlessy :-)

Thanks for the tip Tino, but that means installing pythonu.
I'd like to avoid that, since I won't use it for anything
but this function.

--
Arnaud

#4Tino Wildenhain
tino@wildenhain.de
In reply to: Arnaud Lesauvage (#3)
Re: URL Decoding

Arnaud Lesauvage schrieb:

Tino Wildenhain a �crit :

Arnaud Lesauvage schrieb:

Hi List !

I am looking for an easy URL decoding function.
I thought about using regexp_replace, but I cna't get it to work :

SELECT regexp_replace('foo%B5bar', '%(..)', '\x\\1' , 'g');

'fooxB5bar'

I wanted to replace %BE with the character \xB5 (�, I think), but of
course I am doing this wrong...
Is there a simple way t odo this ?

I was simply using a stored function using pl/pythonu with
urllib (split and unquote). Works flawlessy :-)

Thanks for the tip Tino, but that means installing pythonu. I'd like to
avoid that, since I won't use it for anything but this function.

Yes, but it would not hurt imho. Maybe you can use it for further
datamanipulation once you have it :-) plpythonu comes with postgres
so its just like configuring your database. Btw, I think pl/perl and
friends are able too, if these languages mean more for you.

Regards
Tino