Tomba Posted July 30, 2003 Posted July 30, 2003 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 can't 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!! Quote
JABE Posted July 30, 2003 Posted July 30, 2003 The StreamReader's 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. Quote
*Gurus* divil Posted July 30, 2003 *Gurus* Posted July 30, 2003 One of the StreamReader constructor parameters takes a parameter of System.Text.Encoding, maybe that would help. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Tomba Posted July 30, 2003 Author Posted July 30, 2003 well setting that to unicode gets me always line = nothing can't I specify the exact charset somehow :( :confused: Quote
Administrators PlausiblyDamp Posted July 30, 2003 Administrators Posted July 30, 2003 have you tried System.Text.Encoding.BigEndianUnicode as the encoding type? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Tomba Posted July 30, 2003 Author Posted July 30, 2003 afraid so yes :( all empty lines when I choose UTF7 I get black blocks instead of é and à and stuff. whe choosing ASCII all those special characters appear like question marks damn vb.net can suck big time! :mad: seems like no one knows it too :( Quote
Tomba Posted July 30, 2003 Author Posted July 30, 2003 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 ;) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.