PC Review


Reply
Thread Tools Rate Thread

BUG in StreamWriter

 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      23rd Dec 2003
<(E-Mail Removed)> wrote:
> It affects wintail also, www.wintail.com


That doesn't mean .NET isn't writing it properly though...

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      23rd Dec 2003
<(E-Mail Removed)> wrote:
> Its not XML file, the XML file only is used as the input string, the actual
> output thats being corrupted is a normal text file.
>
> The program had NO reference to encoding (thereby using the default .NET
> mechanism) and that was corrupting the output using StreamWriter with
> FileStream. The solution to this was to construct the StreamWriter with the
> Encoding.Default yet this was my actual issue, why is this default when
> infact its not.


It's not the default for StreamWriter, it's the default encoding for
the Windows box you're running it on.

> It was confusing to me and why can the default .NET
> mechanism (not specifying encoding) handle umlaut chars correctly (if its
> UTF8 as you say).


It can. You just can't read it properly.

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      23rd Dec 2003
Ok, notepad shows it ok, so does the VS editor

Wintail and INTERNET EXPLORER (which is suprising) does not.


"Jon Skeet [C# MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> <(E-Mail Removed)> wrote:
> > Its not XML file, the XML file only is used as the input string, the

actual
> > output thats being corrupted is a normal text file.
> >
> > The program had NO reference to encoding (thereby using the default .NET
> > mechanism) and that was corrupting the output using StreamWriter with
> > FileStream. The solution to this was to construct the StreamWriter with

the
> > Encoding.Default yet this was my actual issue, why is this default when
> > infact its not.

>
> It's not the default for StreamWriter, it's the default encoding for
> the Windows box you're running it on.
>
> > It was confusing to me and why can the default .NET
> > mechanism (not specifying encoding) handle umlaut chars correctly (if

its
> > UTF8 as you say).

>
> It can. You just can't read it properly.
>
> --
> Jon Skeet - <(E-Mail Removed)>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too



 
Reply With Quote
 
Guest
Posts: n/a
 
      23rd Dec 2003
Internet explorer displays it as äåö

"Jon Skeet [C# MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> <(E-Mail Removed)> wrote:
> > Its not XML file, the XML file only is used as the input string, the

actual
> > output thats being corrupted is a normal text file.
> >
> > The program had NO reference to encoding (thereby using the default .NET
> > mechanism) and that was corrupting the output using StreamWriter with
> > FileStream. The solution to this was to construct the StreamWriter with

the
> > Encoding.Default yet this was my actual issue, why is this default when
> > infact its not.

>
> It's not the default for StreamWriter, it's the default encoding for
> the Windows box you're running it on.
>
> > It was confusing to me and why can the default .NET
> > mechanism (not specifying encoding) handle umlaut chars correctly (if

its
> > UTF8 as you say).

>
> It can. You just can't read it properly.
>
> --
> Jon Skeet - <(E-Mail Removed)>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too



 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      23rd Dec 2003
<(E-Mail Removed)> wrote:
> Actually with specifying Encoding.Default wintail and notepad correctly show
> this characters.


Yes, because they're assuming the Windows default encoding.

> Its the actual C# save that it doesnt.


<sigh>

How many times do I need to explain it? C# is working fine - it's just
that your tools don't understand UTF-8. Find a text editor which lets
you pick a UTF-8 encoding, and load the file - you'll see the
characters just fine.

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      23rd Dec 2003
<(E-Mail Removed)> wrote:
> Internet explorer displays it as äåö


Internet Explorer is probably assuming the Windows default encoding as
well.

How well do you actually understand encodings? You might like to read
http://www.pobox.com/~skeet/csharp/unicode.html for more information.

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
Guest
Posts: n/a
 
      23rd Dec 2003
Nothing like plugging your own site.

<sigh> if you get tired of explaining nobody forces you to reply to each and
every post out there, no need to step on others to make your ego bigger. Ive
seen you post before, you do the same every time.


"Jon Skeet [C# MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
<(E-Mail Removed)> wrote:
> Internet explorer displays it as äåö


Internet Explorer is probably assuming the Windows default encoding as
well.

How well do you actually understand encodings? You might like to read
http://www.pobox.com/~skeet/csharp/unicode.html for more information.

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      23rd Dec 2003
<(E-Mail Removed)> wrote:
> Nothing like plugging your own site.


I wrote that page (and various others) to save me from explaining
things in detail repeatedly. It's not like I get money from them or
anything - they're just meant to be helpful.

> <sigh> if you get tired of explaining nobody forces you to reply to each and
> every post out there, no need to step on others to make your ego bigger. Ive
> seen you post before, you do the same every time.


I don't reply to each and every post out there, but it *is*
disconcerting when people clearly don't really read answers. This
thread is pointless - no-one's really saying what .NET is supposedly
doing wrong except in terms of what Notepad/Wintail etc can cope with.
I've explained what's going on numerous times now...

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
Marco Martin
Guest
Posts: n/a
 
      23rd Dec 2003
<sigh>
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Nothing like plugging your own site.
>
> <sigh> if you get tired of explaining nobody forces you to reply to each

and
> every post out there, no need to step on others to make your ego bigger.

Ive
> seen you post before, you do the same every time.
>
>
> "Jon Skeet [C# MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> <(E-Mail Removed)> wrote:
> > Internet explorer displays it as äåö

>
> Internet Explorer is probably assuming the Windows default encoding as
> well.
>
> How well do you actually understand encodings? You might like to read
> http://www.pobox.com/~skeet/csharp/unicode.html for more information.
>
> --
> Jon Skeet - <(E-Mail Removed)>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too
>
>



 
Reply With Quote
 
Marco Martin
Guest
Posts: n/a
 
      23rd Dec 2003
Discussion,

if all you want to do is complain about the people who are here to help you,
perhaps you would feel more at home at this forum instead:
alt.complainers.bitch-n-moan

Others here use this forum as help, and is invaluable for their jobs. I for
one find you quite distasteful to say the least and am asking nicely for you
to be, at the very least respectfull, to the people who take the time to
answer your questions.

Marco.
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Nothing like plugging your own site.
>
> <sigh> if you get tired of explaining nobody forces you to reply to each

and
> every post out there, no need to step on others to make your ego bigger.

Ive
> seen you post before, you do the same every time.
>
>
> "Jon Skeet [C# MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> <(E-Mail Removed)> wrote:
> > Internet explorer displays it as äåö

>
> Internet Explorer is probably assuming the Windows default encoding as
> well.
>
> How well do you actually understand encodings? You might like to read
> http://www.pobox.com/~skeet/csharp/unicode.html for more information.
>
> --
> Jon Skeet - <(E-Mail Removed)>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if System.IO.StreamWriter write throws an exception, is there anyway to close the System.IO.StreamWriter object? it seems to stay open when this happens then future attempts to write to that same path fail because it says its in use by another proces Daniel Microsoft Dot NET 3 8th Sep 2005 06:47 PM
if System.IO.StreamWriter write throws an exception, is there anyway to close the System.IO.StreamWriter object? it seems to stay open when this happens then future attempts to write to that same path fail because it says its in use by another proces Daniel Microsoft C# .NET 3 8th Sep 2005 03:07 PM
System.IO.StreamWriter Close or Flush method to shut down the computer in such a way that just part of the file is written? or an empty file is written? Also if the Close or Flush is to a streamwriter writing to a network share, is it possible for th Daniel Microsoft Dot NET 1 7th Sep 2005 09:02 AM
ASP.NET C# WriteToFile StreamWriter error: 'StreamWriter' could not be found rex64 Microsoft C# .NET 4 15th Jun 2005 03:46 PM
capture using(StreamWriter wr = new StreamWriter()) exceptional kids_pro Microsoft C# .NET 6 3rd Sep 2004 07:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:21 PM.