[thelist] asp.net: Unicode Encoding problem

Peter Wakeford pwakeford at gmail.com
Fri Jul 15 12:42:21 CDT 2005


Casey,

try the following instead, using the constructor instead:

Sub Page_Load(S as Object, E as EventArgs)

        dim onPage as string = Request.QueryString("page")        
        dim filename as string = MapPath("../pages/content_includes/") & onPage & ".ascx"
        dim myStreamWriter as new StreamWriter(filename,false,system.text.encoding.unicode)
        
        myStreamWriter.WriteLine(Session("previewText"))
        myStreamWriter.Close
End Sub

Peter




> I'm using a simple StreamWriter to over right the contents of a file:
> 
> Sub Page_Load(S as Object, E as EventArgs)
> dim myStreamWriter as StreamWriter
> dim onPage as string = Request.QueryString("page")
> myStreamWriter = File.CreateText(MapPath("../pages/content_includes/" &
> onPage & ".ascx"), System.Text.Encoding.UnicodeEncoding )
> myStreamWriter.WriteLine(Session("previewText"))
> myStreamWriter.Close
> End Sub
> 
> I added the ", System.Text.Encoding.UnicodeEncoding " because I was having
> trouble with certain greek charectors being altered when the file was
> re-written.  But I now get this error:
> 
> BC30390: 'System.Text.Encoding.unicodeEncoding' is not accessible in this
> context because it is 'Private'.
> 
> I will confess that all this unicode endcoding is new to me.  What must I do
> to ensure the stability of the content?
> 
> Thanks,
> 
> 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