Fix issue 334, adding urlquote functionality

I've added test for issue reproducing and simple solution for this issue. Please review.
Is it possible to get rid of the try/except block and simply do `quote_plus` on `primary_key_obj.encode('utf-8')`?