Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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!!

Posted

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.

Posted

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 :(

Posted

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 ;)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...