Urlencode query for sqlite
Fix a problem with \' in Traceback values