Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
StreamReader dropping characters
Message
De
06/04/2004 22:11:30
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
StreamReader dropping characters
Divers
Thread ID:
00892796
Message ID:
00892796
Vues:
49
I'm using a StreamReader object like this to read a text file.

Dim sr As New IO.StreamReader(Filename)
Dim Line As String = sr.ReadLine()
Do While (Not Line Is Nothing)
ProcessLine(Line)
Loop
sr.Close()

It's been working fine (or so I thought) for weeks. I just noticed that it was dropping some characters from the stream. Any accented characters are being dropped. "Toms Spezialitäten" gets read as "Toms Spezialitten" (the "ä" gets dropped). This is bad because it changes the data being read, but it's even worse because the lines I'm reading are fixed-width fields and dropping characters shifts all the data in subsequent fields and really screws the data up.

Is this a normal (documented) behavior of StreamReader, and what should I use instead of StreamReader? I can read the file manually, I was just using StreamReader for it's built-in ability to parse "lines" (cr, lf, or cr/lf delimited). But I would think as rich as the .NET framework is, there must be some other kind of stream reader I can use.
-----
Lee Perkins
TigerBase Technologies

"Lee is one that would plug his brain into the internet, if he could, and STILL scream for more" - Very good friend of Lee's
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform