Simple assignment to Content should be sufficient:
Response.Content := doc.XML.Text;
This will both encode the incoming string value and set ContentLength automatically. (See TISAPIResponse.SetContent in Web.Win.IsapiHTTP.)
In your case the encoded stream was longer than the original text, e.g. due to insertion of escape characters. By setting ContentLength explicitly you have effectively truncated the encoded stream.