tags:

views:

26

answers:

1

Hi

I need to create System.Encoding for 1251 codepage.

On my russian Windows I use

Encoding encoding = Encoding.Default

I am afraid this will produce different results depending on Windows

+5  A: 

Correct, you will get different results on different machines if you use Encoding.Default.

If you want a specific codepage, you can use Encoding.GetEncoding:

Encoding encoding = Encoding.GetEncoding(1251);
Michael Madsen
Yeap, I should have just RTFM. Another option is specifying codepage by name instead of number as you did. In my case that would be windows-1251
Captain Comic