473,789 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accentuated char

Hello,

The methods Read() of the class StreamReader don't read the accentuated
characters. When an accentuated character is present in a file, Read() skip
it and read the following character. Missing something?

Thanks for help

P. Cloup
Nov 15 '05
13 2215
GG
I had a similar problem while reading a text file with
unicode and UTF8. Both did not return chars that look weird example ÿ.
Had to use Encoding.ASCII which read all chars but getting ????????? for
unkown ascii chars.
I did not want to loose the bufferRead position so stayed with Ascii.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #11
GG <gg@hotmail.com > wrote:
I had a similar problem while reading a text file with
unicode and UTF8. Both did not return chars that look weird example =3F.
Had to use Encoding.ASCII which read all chars but getting ????????? for
unkown ascii chars.
I did not want to loose the bufferRead position so stayed with Ascii.


That suggests you were using the wrong encoding then - perhaps you
should have used Encoding.Defaul t instead? It's hard to know without
knowing what you were trying to read - but you should know what
encoding your file is in rather than guessing until something works.

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

Thanks for your response!

Skeet said:
Using BinaryReader is a bad idea,
StreamReader is designed for exactly the job required.


Yes, I agree with it, StreamReader is designed for the txt file.

However at first time I try to read the accented characters with
StreamReader, I got null for them, and the BinaryReader actually retrieve
the correct characters, so I think the BinaryReadermay be better.

Today, I tested that program again, and found the StreamReader.Re ad() works
fine this time, I think I have missed something.
Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Nov 15 '05 #13
Gary Chang <v-******@online.m icrosoft.com> wrote:
Skeet said:
Using BinaryReader is a bad idea,
StreamReader is designed for exactly the job required.


Yes, I agree with it, StreamReader is designed for the txt file.

However at first time I try to read the accented characters with
StreamReader, I got null for them, and the BinaryReader actually retrieve
the correct characters, so I think the BinaryReadermay be better.


If BinaryReader was reading the correct characters, then you must have
been giving it the correct encoding, while giving StreamReader the
wrong encoding. BinaryReader isn't capable of guessing an encoding any
better than StreamReader is.

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

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

Similar topics

6
2958
by: Jean-Marc Molina | last post by:
Hello, I'm trying to generate a RSS newsfeed using the DOM XML functions. However I can't find a way to use accentuated characters. I even tried to specify a character encoding set but it doesn't solve the problem. Error I get : XML Parsing Error: not well-formed Location: news.php?action=syndicate&format=rss2 Line Number 1, Column 102:<?xml version="1.0" encoding="ISO-8859-15"?><rss
3
7964
by: Ndeye | last post by:
hi everybody, I would like to parse an xml file containing some accentuated characters like è. This causes my java program to throw this error : file:/c:/dxl/Abbink.xml; Line 216; Column 26 XSL Error: Could not parse c:\dxl\Abbink.xml document! XSL Error: SAX Exception Invalid UTF-8 code. (bytes: 0xffffffe9 0x20)
9
2210
by: Christopher Benson-Manica | last post by:
I need a smart char * class, that acts like a char * in all cases, but lets you do some std::string-type stuff with it. (Please don't say to use std::string - it's not an option...). This is my attempt at it, but it seems to be lacking... I'm aware that strdup() is nonstandard (and a bad idea for C++ code) - please just bear with me: /* Assume relevant headers are included */ class char_ptr {
2
2246
by: Cesar Ronchese | last post by:
Hello, All! I'm working with accentuated characters in my XML files, and I have found problems to load and save it. First, for this case, I always have my XML in memory, and I load it via LoadXML (please, ignore incorrect concatenations for this sample): Dim cXml As New Xml.XmlDocument
2
3423
by: Peter Nilsson | last post by:
In a post regarding toupper(), Richard Heathfield once asked me to think about what the conversion of a char to unsigned char would mean, and whether it was sensible to actually do so. And pete has raised a doubt in my mind on the same issue. Either through ignorance or incompetence, I've been unable to resolve some issues. 6.4.4.4p6 states...
5
6685
by: Marcos Ribeiro | last post by:
Hi I'm trying to read a textfile using System.IO.StreamReader, but all accentuated characters are skiped. Why's that? There is any workaround? Thanks Marcos
2
2189
by: jcdperf | last post by:
Hello, I have small problems while reading of text files containing accentuated characters. (like é è à ç ...). I use this basic code : Dim sr As StreamReader Try sr = New StreamReader(sFichier) Dim sLine As String
4
3226
by: Paul Brettschneider | last post by:
Hello all, consider the following code: typedef char T; class test { T *data; public: void f(T, T, T); void f2(T, T, T);
29
9996
by: Kenzogio | last post by:
Hi, I have a struct "allmsg" and him member : unsigned char card_number; //16 allmsg.card_number
0
9663
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
9511
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10404
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
10195
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...
1
10136
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
7525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
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.