I have this url (ISO-8859-1 encoded):
file://///companyweb/pr%C3%B8ve.doc
which I need transformed into this url (UTF-8 encoded):
file://///companyweb/pr%F8ve.doc
The difference is the character 'ø' which will be encoded as '%C3%B8' in the first case, and as '%F8' in the latter.
In Java I would be able to do this conversion very easy doing something like this..
String iso88591UrlEncoded = "file://///companyweb/pr%C3%B8ve.doc";
String decoded = URLDecoder.decode( iso88591Encoded , "ISO-8859-1" );
String utf8UrlEncoded = URLEncoder.encode( decoded, "UTF-8");
..but Python is very new to and I'm sort of stuck. I have tried several combination of string's decode() and encode() together with urllib's quote() and unquote() methods without much luck. I can't seem to figure out either how to decode it or encode it.
Anyone out there know can give me a clue?