I have a directory in my web proyect with this file:
home.text
and inside the home.txt file I have this text:
ESPAÑA_BOLSA.xlsx
So I have this code in vb.net to extract the text from the .txt file:
Public Shared Function GetTextFromTXT() As String
Dim FilePath As String = HttpContext.Current.Server.MapPath("~/excel/home.txt")
' Creates instance of StreamReader class
Dim sr As StreamReader = New StreamReader(FilePath)
' Finally, loads file to string
Dim FileContent As String = sr.ReadToEnd().ToString
Return FileContent
End Function
but with this code I get this result in Filecontent:
ESPA�A_BOLSA.xlsx
So I use this line to try to decode the text, but is not work:
FileContent = WebUtility.HtmlDecode(FileContent)
The result should be this from the Filecontent string:
ESPAÑA_BOLSA.xlsx
What I'm doing wrong? thanks, I accept suggestions