StreamReader problem in reading BIG-5 file

  • Thread starter Thread starter James Wong
  • Start date Start date
J

James Wong

Dear all,

I'm using StreamReader to read a text file containing BIG-5 data and found
that no matter which encoding method in StreamReader's construction
parameter, the BIG-5 contents become garbage under ReadLine method. Does
anybody have any idea on this issue?

Thanks for your attention and kindly help!

Regards,
James Wong
 
James,
Are you saying that StreamReader.ReadLine itself is having problems, where
as StreamReader.Read is not having a problem?

Or that you are simply having problems reading a BIG-5 encoded file?

I don't have any BIG-5 data files to actually test this, however have you
tried something like:

Dim big5 As System.Text.Encoding =
System.Text.Encoding.GetEncoding("BIG5")

Dim input As New StreamReader("mybig5.txt", big5)
Dim line As String = input.ReadLine()
Do Until line Is Nothing
' process the line here
line = input.ReadLine()
Loop
input.Close()

For information on Unicode and Encoding in .NET see:

http://www.yoda.arachsys.com/csharp/unicode.html

Hope this helps
Jay
 
Hi! Jay,

Thanks for your reply and it works! My original problem occurrs in all
BIG-5 encoded file in using StreamReader.

Regards,
James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top