Reading special characters from CSV with Visual Basic .NET
Posted on 2007-10-02
I created a csv file (using excel 2007). I need to be able to save text from different languages in this file, and I can. I paste phrases in the csv, save it and when I open the file, the phrases show up exactly as I pasted them in. An example of one such phrase is "Disposición". The problem is that I need to process this csv with a visual basic program (using Visual Studio 2005). When I read the lines of the csv into VB, the accented character shows up as a "square"...
Here's a snippet of my code:
Dim fileLine As String
' open the file...
Using streamReader As New IO.StreamReader(txtFileName.Text)
fileLine = streamReader.ReadLine
"fileLine" contains: "Disposiciýn"
Can someone tell me how I can read this csv and get the special characters? I've tried creating my StreamReader like so:
Using streamReader As New IO.StreamReader(txtFileName.Text, Encoding.Unicode)
and this is worse...
Any help would be greatly appreciated!