Damien Churchill schrieb:
>> after several attempts I have finally succeeded in developing a urlencode()
>> function to encode text correctly like defined in RFC 1738.
>>
>> Now i have a big problem: how to decode the text?
>>
>> Example:
>> # SELECT urlencode('Hellö World!');
>> urlencode
>> -----------------------
>> Hell%C3%B6%20World%21
>>
>> Does anybody know a way to convert '%21' back to '!' and '%C3%B6' to 'ö'?
>
> I've extracted the unquote method [0] from urllib in the python stdlib
> that decodes urlencoded strings. Hopefully be some use!
Not directly, but it gives me some helpful hints. For example i'm now
able to decode some basic characters, for example:
# SELECT chr(x'21'::int);
chr
-----
!
(1 row)
But i clearly have a missunderstanding of other chars, like umlauts or
utf-8 chars. This, for example, should return a 'ö':
# SELECT chr(x'C3B6'::int);
chr
-----
쎶
(1 row)
Also i'm not sure how to figure out, when to decode '%C3' and when to
decode '%C3%B6'.
Thanks for your help,
Torsten
--
http://www.dddbl.de - ein Datenbank-Layer, der die Arbeit mit 8
verschiedenen Datenbanksystemen abstrahiert,
Queries von Applikationen trennt und automatisch die Query-Ergebnisse
auswerten kann.