I am reading data from an XML file into an array.
The XML has the following header
Some chars with accent in the data as “Ros”, “Itali” are shown as weird characters.
I had the same problem a few months ago, reading data from a csv file, and could solve the problem by using the following code
if myFile <> Nil then
t = TextInputStream.Open(myFile)
t.Encoding=Encodings.MacRoman
While Not t.EOF
Mijndb.SQLExecute("BEGIN TRANSACTION")
sLijn=t.ReadLine
sLijn = ConvertEncoding(sLijn,Encodings.UTF8)
aSamenstelling = Split(sLijn,";")
MijnRec.Column("art_code")=aSamenstelling(0)
MijnRec.Column("art_omschrijving")=aSamenstelling(1)
MijnRec.Column("art_leverancier")=aSamenstelling(3)
MijnDb.InsertRecord("artikels",MijnRec)
If MijnDb.Error Then
MsgBox MijnDb.ErrorMessage + " " + aSamenstelling(0) + " " + aSamenstelling(1)
Else
ProgressBar1.Value=ProgressBar1.Value+1
End If
tmpRecordset.Close
Wend
Mijndb.Commit
End If
But this doesn’t work this time.
Is encoding of the xml the reason?
How can i solve this problem?
By using an other encoding?