Avoid UnicodeDecodeError when query string is unicode

Fixes PYTHON-76