Fix UTF-8 handling for shared queries

Signed-off-by: Kevin Murphy <murphyke@email.chop.edu>