filestream character encoding ??

Tomba

Member
Joined
Jul 22, 2003
Messages
17
hello all,
I hope you can help me out on this..

on a pc, I need to reed a file with charset "macintosh" , which is equal to Western European(Mac)

I read the file as follows:

fs = New FileStream(Importfile, FileMode.Open, FileAccess.Read)
sr = New StreamReader(fs)

I just cant find how to set the charset to use for reading this file.
How should I do that, so that all letters with accents and stuff are read correctly

thanks a lot in advance!!
 
The StreamReaders constructor is overloaded to accept a second parameter of type Encoding. Perhaps you can specify:

sr = New StreamReader(fs, System.Text.Encoding.Unicode)

Hope this helps.
 
One of the StreamReader constructor parameters takes a parameter of System.Text.Encoding, maybe that would help.
 
well setting that to unicode gets me always
line = nothing

cant I specify the exact charset somehow :( :confused:
 
heya people, found the solution!

the EncodingName of codepage 10000 returns "Western European (Mac)".

imports system.text
...
dim en as encoding
en = encoding.getencoding(10000)
...
sr = new streamreader(fs, en)

still, vb.net is overpowered :o
have fun with this if you would need it ;)
 
Back
Top