473,378 Members | 1,152 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,378 software developers and data experts.

IOStream does not read special characters

Hello,

I am fairly new to vb.net and I have a problem when reading from text file. The file contains characters not found in English (e.g. ?, ?, ?). When I am doing a ReadLine those characters are skipped by vb.net. Does anyone know what to do to fix my problem?

/m

--
Message posted via http://www.dotnetmonster.com
Nov 21 '05 #1
4 4526
Marcus,

The least you should know is the code the file is in.
The class for that is the encoding class

http://msdn.microsoft.com/library/de...ctortopic6.asp

When you know the code you can use as well something as.

\\\\
Dim Str As New StreamReader("path")
Dim arrInput As Byte() = _
System.Text.Encoding.GetEncoding(437).GetBytes(Str .ReadToEnd)
Str.Close()
///

I hope this helps?

Cor
Nov 21 '05 #2
Marcus,

The least you should know is the code the file is in.
The class for that is the encoding class

http://msdn.microsoft.com/library/de...ctortopic6.asp

When you know the code you can use as well something as.

\\\\
Dim Str As New StreamReader("path")
Dim arrInput As Byte() = _
System.Text.Encoding.GetEncoding(437).GetBytes(Str .ReadToEnd)
Str.Close()
///

I hope this helps?

Cor
Nov 21 '05 #3
"Marcus O via DotNetMonster.com" <fo***@DotNetMonster.com> schrieb:
I am fairly new to vb.net and I have a problem when reading from text
file. The file contains characters not found in English (e.g. ?, ?, ?).
When I am doing a ReadLine those characters are skipped by vb.net. Does
anyone know what to do to fix my problem?


Depending on the encoding that was used to write the file, specify an
encoding ('System.Text.Encoding.*') in the 'StreamReader''s constructur.
BTW: I don't see the characters that are not read (they are relplaced by
question marks in your message.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
"Marcus O via DotNetMonster.com" <fo***@DotNetMonster.com> schrieb:
I am fairly new to vb.net and I have a problem when reading from text
file. The file contains characters not found in English (e.g. ?, ?, ?).
When I am doing a ReadLine those characters are skipped by vb.net. Does
anyone know what to do to fix my problem?


Depending on the encoding that was used to write the file, specify an
encoding ('System.Text.Encoding.*') in the 'StreamReader''s constructur.
BTW: I don't see the characters that are not read (they are relplaced by
question marks in your message.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Roy W. Andersen | last post by:
I've been searching google about this for days but can't find anything, so I'm hoping someone here can help me out. I'm trying to create zip-files without needing the zip-file extension in PHP,...
19
by: ernst.stiegler | last post by:
Hello, I just want to read a whole line from a console input. What I don't understand is that I always have to press ENTER twice in order to see the line I've entered. Here's my code : ...
38
by: Martin Marcher | last post by:
Hi, I've read several questions and often the answer was 'C knows nothing about .' So if C knows that little as some people say, what are the benefits, I mean do other languages know more...
24
by: David Mathog | last post by:
If this: int i,sum; int *array; for(sum=0, i=0; i<len; i++){ sum += array; } is converted to this (never mind why for the moment):
19
by: James Harris | last post by:
My K&R 2nd ed has in the Reference Manual appendix, A7.4.8 sizeof yields the number of BYTES required to store an object of the type of its operand. What happens if C is running on a machine that...
0
by: Marcus O via DotNetMonster.com | last post by:
Hello, I am fairly new to vb.net and I have a problem when reading from text file. The file contains characters not found in English (e.g. ?, ?, ?). When I am doing a ReadLine those characters are...
18
by: Seeker | last post by:
I essentially copied this program from K&R: #include <stdio.h> #include <stdlib.h> int main() { int c;
4
by: Herman.Schultz | last post by:
Hi, How can I use iostream library in c++ to copy a file from i th byte to an output file? Thank you.
0
by: veer | last post by:
Hi can any one help me by providing the method how i read the text from html file. i did it by this method Open newstr For Input As #1 While Not EOF(1) ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.