Read a. txt file in ANSI VB.net

Asked

Viewed 952 times

-1

I’m trying to read a text file using basic visual, but it puts "?" in the words with accent and cedilla, for example, how do I make him read the files in ANSI format ? this doesn’t work:

Dim ArqTemp As String = File.ReadAllText(Arquivo, Encoding.UTF8)
  • 1

    Try to change the Encoding.UTF8 for System.Text.Encoding.GetEncoding(850)

  • He placed characters such as: "Applications "

  • 1

    Tries 860 @Aesir

  • @Did it work? The Jéferson should put as answer?

  • I haven’t, it’s like this now: "APPLY ES"

  • 1

    Are you sure you’re in UTF-8? Try as an ANSI: File.ReadAllText(Arquivo, Encoding.GetEncoding("ISO-8859-1"))

  • Bah truth man, so it worked!

Show 2 more comments

1 answer

1

Try it like this:

 Dim ArqTemp As String = File.ReadAllText("D:\acento.txt", Encoding.Default)

print

Browser other questions tagged

You are not signed in. Login or sign up in order to post.