Fix issue 334, adding urlquote functionality

I've added test for issue reproducing and simple solution for this issue. Please review.
No, I've tried. It can be integer, which doesn't have `encode` method. It would be easier, if you drop python 2 compatibility =)))