Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem with Readline in VB.Net

Posted on 2007-03-26
5
Medium Priority
?
1,306 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 64

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 64

Accepted Solution

by:
Fernando Soto earned 1000 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 64

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

670 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