[thelist] ASP.NET: & charector problems using StreamWriter

VOLKAN ÖZÇELİK volkan.ozcelik at gmail.com
Tue Jul 12 21:22:41 CDT 2005


Seems like a localization quirk :)

If so, this may help:

----
Encoding locale = System.Text.Encoding.GetEncoding(Constant.CODEPAGE);
StreamReader sr = new StreamReader(sourcePath,locale);
String strCompress = sr.ReadToEnd();
sr.Close();
Compress(ref strCompress);
StreamWriter sw = new StreamWriter(destinationPath, false, locale);
sw.Write(strCompress);
sw.Close();
---

Where Constant is my pre-defined class. and CODEPAGE refers to the
windows code page (most probably for you it is 1252 or 1254)

The code above is extracted from my article
(http://www.codeproject.com/csharp/JSCodeCompressor.asp) in case you
may want to see it in action.

HTH 
Volkan.

On 7/13/05, Casey <aspnet at thecrookstons.com> wrote:
> > > Here's the thing.... whenever the file is re-written with the code
> above, it
> > > changes the symbol to µ.  it doesn't matter if I start with µ or with
> > > &micro; - it ends up µ.
> > >
> > > I'm stumped.  It's such a silly problem, but I can't make it go away.
> 
> 
> > What is your charset? (I suspect UTF-8 might solve your problem.)
> 
> Thanks T.R.  Without reading up on the links you sent, this makes some
> sense.  But, I'm not sure this is heading down the right path for a solution
> to this problem.... would this have anything to do with why my µ's are
> becoming µ's when streamwriter overwrites the pages?  I'm thinking it's
> some sort of asp.net quirk rather then a charset problem, but of course I
> could be wrong.
> 
> Casey
> 
> --
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>


More information about the thelist mailing list