TypeError: unsupported operand type(s) for %

The query is now encoded after it has been escaped

Fixing #109 and #110

Thanks to @jsevilleja for first describing the fix