The following code is used to read a file line by line.
This is a very early version, so all I want to do is show the line in the immediate window. It works great, except that characters like Ä Ö è à, etc. are replaced with a black square with a question mark. According to the documentation, the file reader should be compatible with UTF-8 characters, so I don’t know what is wrong.
... Dim reader = File.OpenText(filetoimport.Text) Dim line As String = Nothing Dim lines As Integer = 0 While (reader.Peek() <> -1) line = reader.ReadLine() If line.StartsWith("<item key=""") Then Dim Firstpart As String = Nothing Firstpart = line.Substring(11, line.IndexOf(""" value=") - 11) Debug.WriteLine(Firstpart) lines = lines + 1 Label3.Text = lines Application.DoEvents() Else Label3.Text = lines Application.DoEvents() End If End While ...
The file is encoded by ANSI, not UTF-8, but the reader uses UTF-8.
user2452250
source share