Python URL decoding?

javascript, python

Solution

Simply try to decode it:

urllib2.unquote('%C3%B8').decode('utf-8')   # --> 'ø'

Problem

In javascript I do the following: ``` encodeURIComponent(comments) ``` while in Python i do the following: ``` urllib2.unquote(comments) ``` For some reason, when I do the following: ``` encodedURIComponents('ø') ``` I get `%C3%B8`, but when I decode ``` urllib2.unquote('%C3%B8') ``` I get `ø` instead of `ø`, which is the original character. What gives? I'm on a platform that uses jQuery on client side, and Python/Django server side.

Original source