Text imported from text file to textbox does not show the seats correctly

0

I'm developing a notepad and I'm having trouble importing text from a text file where this text has multiple setups, but after importing to a multiple textbox lines, instead of the seats a different symbol appears. As in the image below

IalreadytriedsomeformsbutitstaysthesamethiswasthelastcodeItried

OpenFileDialog1.Title="Open Text File"
    OpenFileDialog1.InitialDirectory = "C:\"
    OpenFileDialog1.ShowDialog()

    Dim textFile As StreamReader

    textFile = File.OpenText(OpenFileDialog1.FileName)
    TextBox1.Text = textFile.ReadToEnd()

    textFile.Close()
    
asked by anonymous 26.10.2018 / 09:41

1 answer

0

In fact after several attempts and to find I found 2 solutions that I used. in fact the first situation was to re-save the text file with utf-8 and the second one I applied in code that I found online Social msn forum This is my current code:

Public Function RemoveAcentos(ByVal texto As String) As String
    Dim charFrom As String = "ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ"
    Dim charTo As String = "SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy"
    For i As Integer = 0 To charFrom.Length - 1
        texto = Replace(texto, charFrom(i), charTo(i))
    Next
    Return texto
End Function

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
    TextBox1.Text = RemoveAcentos(TextBox1.Text.ToString)
End Sub
    
26.10.2018 / 10:28