Hello, All!
I'm working with accentuated characters in my XML files, and I have found
problems to load and save it.
First, for this case, I always have my XML in memory, and I load it via
LoadXML (please, ignore incorrect concatenations for this sample):
Dim cXml As New Xml.XmlDocument
Dim strXML as String
strXML = "<?xml version="1.0" encoding="ISO-8859-1"?>
<SETTINGS>
<COLUMNS>
<COLUMN INDEX="Code" WIDTH="0" Alias="Código">
</COLUMN>
</COLUMNS>
</SETTINGS>"
cXml.LoadXml(Settings)
'done, then I can do my changes
'.....
Then, when I need restore to memory that XML, the word "Código" becomes
"Csdigo". I save this manner:
Dim ms As New IO.MemoryStream
Dim arrBytes() As Byte
dim strXML as String
'saves my xml to a MemoryStream object
myXMLObject.Save(ms)
'read XML from MemoryStream
ms.Position = 0
ReDim arrBytes(ms.Length - 1)
ms.Read(arrBytes, 0, ms.Length)
'convert the bytes to string
Dim AE As New System.Text.ASCIIEncoding
strXML = AE.GetString(arrBytes)
Well, the word "Código" remains changed to "Csdigo". Its OK, if only in
files or strings, but, when I try reload to XML object again, the value
remains "Csdigo".
Have I made somethink wrong? Or there are some solution for it?
Thanks in advance!
Cesar