Solved

Problem with Readline in VB.Net

Posted on 2007-03-26
5
1,303 Views
Last Modified: 2013-11-26
I want to read a textfile in VB.Net using the commando readline:
Dim fileinput = New StreamReader("C:\Front_End\Upload\filiaal_0002.all", System.Text.Encoding.UTF8)
sline = fileinput.readline
This statement omit several charaters (for instance ", ')

How can i read and write this special characters??
0
Comment
Question by:Tilbu_Soft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 18799792
Hi Tilbu_Soft;

The stream reader should be able to read those characters already. Can we see a sample of the file that you are having problems with?

Fernando
0
 

Author Comment

by:Tilbu_Soft
ID: 18801750
Here is a sample of the file:
AR060230PLPlatinum 450/M + 15“moniIN3016788820070327016788820070327701020         HAWA12J   0137178        NJN 20070327 0167888  0000000                                                             T

Position 30 = omitted    Value = Hex 93    
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 250 total points
ID: 18802628
hI Tilbu_Soft;

I am sorry, by the looks of the characters posted in the question, (for instance ", '), they looked like a double quote comma an a single quote. The encoding of the text is in your data is found on Code Page 1252. The below code should work. or you can use the System.Text.Encoding.Default in place of System.Text.Encoding.GetEncoding("windows-1252") but it is safer to use the one shown below.

        Dim fileinput As New StreamReader("C:\Front_End\Upload\filiaal_0002.all", System.Text.Encoding.GetEncoding("windows-1252"))
        Dim sline As String = fileinput.ReadLine
        fileinput.Close()


Fernando
0
 

Author Comment

by:Tilbu_Soft
ID: 18806195
This is the solution.....thank you

0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 18807749
Not a problem, glad I was able to help. ;=)
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

634 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question