473,402 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

StreamReader problem in reading BIG-5 file

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
2 4158
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
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> ¦b¶l¥ó
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: some guy | last post by:
Note: This is happening under the VS05 February CTP release. I haven't had a chance to run it under Beta 2 yet. I have a StreamReader that is reading a NetworkStream from a TcpClient, which is...
6
by: No_Excuses | last post by:
All, I am interested in reading the text of a web page and parsing it. After searching on this newgroup I decided to use the following: ******************************* START OF CODE...
9
by: oafyuf | last post by:
Hi, I'm having performanbce issues with StreamReader and was wondering what I could do to improve it... The following takes around 3 seconds to process! The content of the response is: ...
3
by: redneon | last post by:
I have a program which is constantly reading from a stream and what I'm wanting to do is, if the stream hasn't sent anything after a certain amount of time then do something. I've tried doing this...
21
by: JoKur | last post by:
Hello, First let me tell you that I'm very new to C# and learning as I go. I'm trying to write a client application to communicate with a server (that I didn't write). Each message from the...
5
by: z. f. | last post by:
Hi, i have a vb.net windows application that makes HTTP requests with the framework's HttpWebReqeuest object. i have about 10 different requests that takes between 30 to 500 for the...
0
by: Al Wilkerson | last post by:
Hey, Has anyone ever got a "Unable to read data from transport connected" message after reading data from a streamreader composed of a networkstream. For example: Server TcpListener...
2
by: Eddy | last post by:
I have a big problem with streamreader ReadLine()! I read from a long text files about 13k lines, than I encounter a problem: ReadLine() is not anymore able to go on! I have a string whose name is...
11
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS 2005, ,.net 2 for C# windows application. I'm using Process to run a C application and redirecting its standard output so I can read it with StreamReader.ReadToEnd. It's only...
3
by: Tony Johansson | last post by:
Hello! I just wonder in this specific case is it any advantage to use a TextReader a reference to a StreamReader ? Try { TextReader tr = new StreamReader(locationTextBox.Text); Try {
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.