Solved

Problem with Readline in VB.Net

Posted on 2007-03-26
5
1,292 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
  • 3
  • 2
5 Comments
 
LVL 62

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 62

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 62

Expert Comment

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

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
I need help embedding Base64 Images using VB.Net - When image is a .jpg 2 57
Name space syntax error 12 56
Change Format on Data when exporting to Excel 4 32
ASP.NET MVC 2 31
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

785 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