Properly encode/decode text when adding to query string [MJ-433]

URLs should already consist solely of ASCII code points, but they're stored as unicode strings in the database. This was causing urllib.urlencode to pitch a fit.