When using XmlTextWriter to write XML to a memory stream, you can specify the encoding type when create the XmlTextWriter instance. Dim oStream As IO.MemoryStream = New IO.MemoryStream() Dim oXmlWriter As New Xml.XmlTextWriter(oStream, System.Text.Encoding.ASCII) oXmlWriter.WriteStartDocument() 'Top level (Parent element) oXmlWriter.WriteStartElement("Invoice") 'Child elements, Invoice Message oXmlWriter.WriteStartElement("InvoiceMessage") oXmlWriter.WriteString("This is a test.") oXmlWriter.WriteEndElement() oXmlWriter.WriteEndElement() 'End top level element oXmlWriter.WriteEndDocument() 'End Document oXmlWriter.Flush() 'Write to stream If you want to read the content from the underlining memory stream, you might be using following code: oStream.Position = 0 Dim oContent(oStream.Length) As Byte oStream.Read(oContent, 0, oStream.Len