"Thomas A" <thomasalbertsson@msn.com> schrieb[color=blue]
> Hi,
>
> I write a string value to a textfile , if the string dont contains
> swedish Å,Ä and Ö , the file will be written in ANSI.
>
> So far so god but....
>
> If the string contains Å or Ä or Ö ,the file will be written in
> UTF-8.
>
> Thats not good, have anyone a tips for me so it always will be
> written in ANSI.
>
> My code is now:
>
> 'The Outstring contains my string to write into my file
>
> Dim OutPath as string = "c:\test.txt"
> Dim mySW As StreamWriter
>
> mySW = File.CreateText(OutPath)
>
> ' Debug.Write(mySW.Encoding)
> mySW.Write(Outstring)
> mySW.Close()
> mySW.Flush()
>
>
> //Thomas[/color]
dim fs as filestream
fs = new filestream(outpath, ...)
mysw = new streamwriter(fs, System.Text.Encoding.Default)
--
Armin
http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html