473,767 Members | 2,224 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Missing chars after reading line

Hi,

I'm just developing a .net (compact) application and therefore make use of
the StreamReader class - and especially the ReadLine function. Now, when I
try to read lines from a text file that includes 'german' strings with
specific chars (like ä,ü,ö, etc.) they do not appear in the returned string.
What's wrong here?

By the way, if it is of any importance, I currently use an english version
of VS.net 2003 - that's why there's also an english .net framework installed
on the pocket pc I'm testing on.

Greetings,
Andreas
Jul 21 '05 #1
2 1220
Sounds like it might be an encoding issue. I would say (a) make sure that
you're using the latest service pack (SP3 [1]), and (b) try explicitly
specifying an encoding when creating the StreamReader instance. There are
some conversations in the google archives about this, here is one.
http://www.google.ca/groups?hl=en&lr...254040tude.net

[1]
http://www.microsoft.com/downloads/d...DisplayLang=en

--
Tim Wilson
..Net Compact Framework MVP

"Andreas" <An*****@discus sions.microsoft .com> wrote in message
news:8B******** *************** ***********@mic rosoft.com...
Hi,

I'm just developing a .net (compact) application and therefore make use of
the StreamReader class - and especially the ReadLine function. Now, when I
try to read lines from a text file that includes 'german' strings with
specific chars (like ä,ü,ö, etc.) they do not appear in the returned string. What's wrong here?

By the way, if it is of any importance, I currently use an english version
of VS.net 2003 - that's why there's also an english .net framework installed on the pocket pc I'm testing on.

Greetings,
Andreas

Jul 21 '05 #2
Andreas <An*****@discus sions.microsoft .com> wrote:
I'm just developing a .net (compact) application and therefore make use of
the StreamReader class - and especially the ReadLine function. Now, when I
try to read lines from a text file that includes 'german' strings with
specific chars (like ?,?,?, etc.) they do not appear in the returned string.
What's wrong here?

By the way, if it is of any importance, I currently use an english version
of VS.net 2003 - that's why there's also an english .net framework installed
on the pocket pc I'm testing on.


Chances are you're using the wrong encoding.

See http://www.pobox.com/~skeet/csharp/unicode.html

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #3

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

Similar topics

8
3151
by: Nick | last post by:
Hi ! I want to load an old Pascal-Dos-File where records stand in. When i view the file in a HEX-Editor it's clear how to acces these Strings and chars in that file. Since these are old 8BIT chars (C# uses 16BIT) i read the file bytewise and convert the bytes to chars using ENCODER.getChars(). From the chars i make a big String which should be the file as i see in the HEX-Editor. But there are many errors
2
252
by: Andreas | last post by:
Hi, I'm just developing a .net (compact) application and therefore make use of the StreamReader class - and especially the ReadLine function. Now, when I try to read lines from a text file that includes 'german' strings with specific chars (like ä,ü,ö, etc.) they do not appear in the returned string. What's wrong here? By the way, if it is of any importance, I currently use an english version of VS.net 2003 - that's why there's...
16
2799
by: lovecreatesbeauty | last post by:
/* When should we worry about the unwanted chars in input stream? Can we predicate this kind of behavior and prevent it before debugging and testing? What's the guideline for dealing with it? As shown below line #21, I should remove the unwanted characters in input stream there at that time. Do I miss some other possible errors in i/o which will happen to occur sometimes in other places? And welcome your kind comments on following the...
8
1723
by: bart.kowalski | last post by:
I'm trying to read a text file that contains international (specifically Polish) characters line by line. I'm using the following C# code: FileStream lStream = new FileStream(pFileName, FileMode.Open); using (StreamReader lReader = new StreamReader(lStream)) { string lLine; while ((lLine = lReader.ReadLine()) != null) ProcessLine(/* blah..blah */);
8
2129
by: Elijah Cardon | last post by:
1 1 1 1 1 1 2 2 2 1 1 1 3 3 3 1 1 1 4 4 1 2 1 1 5 5 2 2 1 1 6 6 3 2 1 1 7 7 1 3 1 1 8 8 2 3 1 1 9 9 3 3 1 1 10 10 1 1 2 1
0
1400
by: Dustin J. Mitchell | last post by:
I'm building an interface to Amazon's S3, using httplib. It uses a single object for multiple transactions. What's happening is this: HTTP PUT /unitest-temp-1161039691 HTTP/1.1 HTTP Date: Mon, 16 Oct 2006 23:01:32 GMT HTTP Authorization: AWS <<cough>>:KiTWRuq/6aay0bI2J5DkE2TAWD0= HTTP (end headers) HTTP < HTTP/1.1 200 OK HTTP < content-length: 0 HTTP < x-amz-id-2: 40uQn0OCpTiFcX+LqjMuzG6NnufdUk/..
5
1955
by: MLH | last post by:
I'm using A97 import data wizard to import text file N2 a table. The text file is a DIR listing produced by running dir jdc*.* /s c:\JDCs.txt The wizard is chopping the lines off at the leftmost 80 chars. Dunno why - I don't know how to configure it to grab longer lines than that. I made the TARGET table field a memo field. That didn't help. Ideas anyone?
9
6960
by: Matthew | last post by:
I'm using PHP version 4.4.3. The manual page for PHP's mail() function (URL below) says that for the message (IE. email body) "Each line should be separated with a LF (\n). Lines should not be larger than 70 characters." http://uk2.php.net/manual/en/function.mail.php To see what happened I just sent an email using mail() with one of its lines exactly 100 chars. It was sent perfectly by sendmail as a line of
13
3750
by: Hongyu | last post by:
Hi, I have a datetime char string returned from ctime_r, and it is in the format like ""Wed Jun 30 21:49:08 1993\n\0", which has 26 chars including the last terminate char '\0', and i would like to remove the weekday information that is "Wed" here, and I also would like to replace the spaces char by "_" and also remove the "\n" char. I didn't know how to truncate the string from beginning or replace some chars in a string with another...
0
9571
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10168
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10009
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.