[Mono-list] System.Text.Encoding and StreamReader

Paul paul at all-the-johnsons.co.uk
Sat Sep 13 07:06:07 EDT 2008


Hi,

I've been looking at how to read in a CSV file which is in ISO-8559-15
form (that is to say, saved out as ISO-8859-15).

I'm now looking at a way of bringing the CSV file back in to a little
program of mine, but I'm unsure of what I need to do so that it's read
as ISO-8859-15.

Looking at MSDN, System.Text.Encoding looks to be what I need with a
line akin to 

StreamReader srAsciiFromFile = new StreamReader(@"testfile.csv",
System.Text.Encoding.ASCII);

Obviously Encoding.ASCII would not be right for 8859-15, but looking at
MSDN for System.Text.Encoding, it looks like I need to set the codepage
as 28605
(http://msdn.microsoft.com/en-us/library/system.text.encoding(VS.80).aspx) but there isn't really a SetEncoding method for reading and Encoding.Unicode looks to be right, but I'm not sure if it will support 8859-15

Any help on this would be appreciated.

TTFN

Paul
-- 
Sie können mich aufreizen und wirklich heiß machen!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.ximian.com/pipermail/mono-list/attachments/20080913/4f3bc043/attachment.bin 


More information about the Mono-list mailing list