473,516 Members | 3,466 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 1197
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*****@discussions.microsoft.com> wrote in message
news:8B**********************************@microsof t.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*****@discussions.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.com>
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
3126
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...
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...
16
2773
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...
8
1711
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(/*...
8
2104
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
1389
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 <...
5
1941
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...
9
6228
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...
13
3718
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...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7405
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. ...
0
7574
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...
1
7136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7547
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3252
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1620
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
1
823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
487
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...

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.