Fix query error for multibyte strings