Unicode errors in query

This fixes bug #39