By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,639 Members | 1,326 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,639 IT Pros & Developers. It's quick & easy.

StreamReader problem in reading BIG-5 file

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

"James Wong" <cp*****@commercialpress.com.hk.NO_SPAM> wrote in message
news:eW**************@TK2MSFTNGP11.phx.gbl...
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

Nov 20 '05 #2

P: n/a
Hi! Jay,

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

Regards,
James

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> bl
news:Oc**************@tk2msftngp13.phx.gbl g...
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

"James Wong" <cp*****@commercialpress.com.hk.NO_SPAM> wrote in message
news:eW**************@TK2MSFTNGP11.phx.gbl...
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


Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.