readline - vb.net

I really need help with this text file. When there is this weird symbols(char) or whatever we call it on a text file, it reads partial "before a" but it does not returns anything after. This txt file is only part it. The problem is I don't know when there is going to be that char in a txt file.


        Dim sr As New StreamReader(sourcedir) ', System.Text.Encoding.Unicode)

        Dim tmp As String

        tmp = sr.ReadLine
        Me.TextBox1.Text = tmp
VBdotnet2005Asked:
Who is Participating?
 
abelConnect With a Mentor Commented:
What file? It is probably a carriage return or a line feed, without the corresponding cr/lf character (they come in pairs on windows). It can also be any other control character that is considered a newline character. It can even be any of the Unicode newline characters (0x80?), which disrupt correct reading.

You can alternatively read it character for character and create your own lines, plus filter those characters out.
0
 
VBdotnet2005Author Commented:
please see the file
0
 
VBdotnet2005Author Commented:
I uploaded my file. Could you show me in code?
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
VBdotnet2005Author Commented:
I clicked add file and uploaded it.
0
 
abelCommented:
you say that three times... but I think your file is not allowed. Change the extension to *.txt or something.
0
 
abelCommented:
hmm, you'll have to bear with me for a moment, I have to be off, but somebody else will take over. I'll be back in a few hours though... ;)
0
 
VBdotnet2005Author Commented:
it is txt file.
0
 
abelCommented:
Well, I believe you, but something is odd about it and it doesn't upload here, which is strange, because txt files can always be uploaded, I do it all the time and quite often they're actually binary files and it goes all fine.

I'd love to help you, but I do need to have a look at that file. You can also try uploading it somewhere else and send the link here.
0
 
VBdotnet2005Author Commented:
I figured out out.. I used peek <> -1 method  and system.text.encoding.default.  It worked.
You can close it out now.
0
 
VBdotnet2005Author Commented:
thanks for your help.
0
 
abelCommented:
> It worked. You can close it out now.

ah, that's something only you can do.. :)

As it turns out, this is what I suggested in my first comment, #24330447. I'll leave it up to you to award points or to accept your own comment as answer + award points... :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.