Re: Encoding.Default and Encoding.UTF8

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Hardy Wang (hardy_wang_at_marketrend.com)
Date: 06/09/04


Date: Wed, 9 Jun 2004 10:18:39 -0400

Thanks,
Anybody knows are there any characters in French and Spanish greater than
128 ASCII code?

-- 
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy
"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1b30ca2a1ed9934b98ab92@msnews.microsoft.com...
> Hardy Wang <hardy_wang@marketrend.com> wrote:
> > I have following code:
> > Encoding mode; // Encoding.Default or Encoding.UTF8
> > FileStream sb = new FileStream(fullPathAndFileName, FileMode.Create);
> > StreamWriter sw = new StreamWriter(sb, mode);
> > sw.Write(textContent);
> > sw.Close();
> >
> > My question is under what situation, the saved files are different by
> > calling Encoding.Default and Encoding.UTF8.
>
> They'll almost certainly be different for any string containing non-
> ASCII characters. They're likely to be the same for any string
> containing solely ASCII characters.
>
> See http://www.pobox.com/~skeet/csharp/unicode.html for more
> information.
>
> -- 
> Jon Skeet - <skeet@pobox.com>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too


Relevant Pages

  • Re: Slightly tricky string problem
    ... I have a String, which is single character eg "a" ... ASCII is a code defining 128 entities, ... So an UTF-8 encoded file containing only ASCII characters shall ... Unicode didn't define codepoints outside the BMP. ...
    (comp.lang.java.programmer)
  • Re: Slightly tricky string problem
    ... I have a String, which is single character eg "a" ... ASCII is a code defining 128 entities, ... So an UTF-8 encoded file containing only ASCII characters shall ... Unicode didn't define codepoints outside the BMP. ...
    (comp.lang.java.programmer)
  • Re: encrypt email address to a string
    ... would simply reverse the string, like Abigail said or remove the ... You don't want to do an even ASCII exchange mapping because you don't ... and make a simple escape sequence for illegal characters), ... will no be transferring integers, ...
    (comp.lang.perl.misc)
  • Re: Reading an Ascii string
    ... When said "Ascii characters", I meant that they are stored as bytes rather than 16-bit quantities as unicode requires. ... so a string with three characters appears as byte 0x14 followed by the three characters followed by 17 space characters. ... I'll get rid of the text box and store them directly in the database. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Writing extended ascii characters to text file.
    ... so in order to get real ASCII codes you should use the GetBytes ... method of an Encoding instance configured for the ASCII encoding (as far as ... again, you've got bytes, not characters. ... > string line; ...
    (microsoft.public.dotnet.languages.csharp)