Fix unicode errors from psycopg2.