How do i import special text characters from a text file?

hi,

i was wanting to import special charcters from a text file, and using the following code, visual basic ignores charcters such as and ?. All other characters are imported fine.

Dim TextFileStreamAs System.IO.TextReader

' Load the textfile into the stream

TextFileStream = System.IO.File.OpenText(txtTempLocation.Text)' Where txtTempLocation.text is the file location

' Read to the end of the file into a String variable.

Dim MyFileContentsAsString = TextFileStream.ReadToEnd

strFileContents = MyFileContents

' Close the Stream object

TextFileStream.Close()

--Can someone please help. in need this 2 work.--

1noob

[1240 byte] By [1NooB] at [2007-12-24]
# 1

System.IO.File.OpenText assumes that the text in the file is UTF-8 Encoded. I would suggest that you either use My.Computer.FileSystem.ReadAllText and specify the correct encoding or use a System.IO.StreamReader and specify the correct encoding of the file in the constructor.

Best regards,
Johan Stenberg

MSJohanStenberg at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 2
thanx heaps

MS Johan Stenberg. works well.

1NooB at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Language...