Fixed invalid character string handling for XML results