Edward
Sat Jan 29 08:45:02 CST 2005
Thanks,
I knew it was UTF-8 and noticed that indeed the accented characters were
written as double byte. How can I write it as a single byte? For example the
capital A with two dots above converted to ascii-code 142.
"Jon Skeet [C# MVP]" wrote:
> Edward <Edward@discussions.microsoft.com> wrote:
> > I think I overlook something, but when a write to a text file using a
> > StreamWriter, the file is written as unicode.
>
> By default it's written as UTF-8.
>
> > I'm writing information that is
> > retrieve from nvarchar fields on SQL server. I have a problem with characters
> > like ?, ?, etc. When looking at the file they seems to be correct, but in
> > some applications the characters are shown as ?? or ??. How can I write
> > single byte characters to the file? Just specifying new
> > StreamWriter(FileName, false, Encoding.ASCII) doesn't solve the problem,
> > because the characters are completely wrong. Please advise.
>
> I assume those question marks are meant to have non-ASCII characters -
> eg accented characters. Note that ASCII doesn't have any accents - what
> people often think of as "extended ASCII" is a variety of 8-bit
> character sets which are compatible with ASCII for the first 128
> values.
>
> See
http://www.pobox.com/~skeet/csharp/unicode.html
>
> --
> Jon Skeet - <skeet@pobox.com>
>
http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too
>