Truncate user-supplied data to prevent XML errors