Hi again Chiph,
I have been struggling with this encoding thing. This code seem to work but I know to little about the result:
Dim encoding As System.Text.Encoding = System.Text.Encoding.GetEncoding(1251)
Dim i As Integer
For i = 0 To LangDic.Count - 1
Dim l As Language
l = CType(LangDic(i), Language)
l.DateCreated = Now
Dim ms As New MemoryStream
Dim xml As New XmlTextWriter(l.FileName, encoding)
xml.Formatting = Formatting.Indented
Dim saveXML As New XmlSerializer(l.GetType())
saveXML.Serialize(xml, l)
ms.Seek(0, System.IO.SeekOrigin.Begin)
Dim reader As New StreamReader(ms)
Dim buf As String = reader.ReadToEnd()
xml.Close()
reader.Close()
Try
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Next
Using different encodings will give me different results(!) but the results don't show up correctly in my application. I use the following procedure:
1. Translator enters a translation through a webscript, the translation is being inserted in a mysql database. When the translator looks at the translation it looks ok in the browser.
2. I use a application, with the above code, to connect to the mysql, load the columns into a class, and serialize it. This works fine.
3. I use the created XML-file in my application, deserializing it. This works fine. The problem is ( and I lack of knowledge here ) is that the text that is show is displayed just as it is in the xml-file. It seems like I have to decode or convert the text into the right characters or something.
I tried the following. I opened a textfile of another application with russion in it. It looked just like my xml-file (but not russian). I pasted a line of my xmlfile into that file and opened the file in Word. Word sensed that it contained another encoding and asked me if I wanted to see it in Cyrillic encoding or something. Then, even, my words looked russian. So, it seems that the XML-file now have the correct encoding, it's just my application that must handle it. How can I do that? Do I set it on the font of a button for example, or do I do a special deserializing?
Any more help would be appreciated!
---
neteject.com - Internet Solutions ---