changing XmlTextWriter's character encoding to 8859-1

I've got an xml document that uses the 8859-1 standard 7-bit ASCII character set.. but for some reason when i read it to an xmldocument and spit it back out some values look like garbage

if i remove the tag:
<?xml version="1.0" encoding="ISO-8859-1"?>
everything is displayed correctly (in IE when viewing the xml file) obviously the data is not being output using the same character set as i read it in.. is there any way to force the XmlTextWriter to use specific character encoding (like 8859-1)?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fernando SotoRetiredCommented:
Have you tried the following?

Dim xmlTW As New XmlTextWriter(FileName, Encoding.ASCII)

or if using streams

Dim xmlTW As New XmlTextWriter(StreamName, Encoding.ASCII)
Fernando SotoRetiredCommented:
Sorry I for got what section I was in, try it this way.

XmlTextWriter xmlTW = new XmlTextWriter(FileName, Encoding.ASCII)

or if using streams

XmlTextWriter xmlTW = new XmlTextWriter(StreamName, Encoding.ASCII)
CajonesAuthor Commented:
heh, i figured out what you meant ;)
what do i need to include for Encoding? its saying its not defined.
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Fernando SotoRetiredCommented:

using System.Text

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CajonesAuthor Commented:
that did it, thanks!
CajonesAuthor Commented:
hey, i posted a follow up question here:

now that ive got it speaking ASCII, ive got some high value characters that dont fit in ASCIIs 7bit playground. Any idea how to get it to encode those high values as unicode escape sequences?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.