473,387 Members | 1,529 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,387 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 4529
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) ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.