Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
// 1251
byte[] b = { 0xEF, 0xF0, 0xE8, 0xE2, 0xE5, 0xF2 };
BinaryWriter binout = new BinaryWriter(new FileStream("C:/Users/sl/source/repos/Lab/Lab/bin/Debug/netcoreapp3.1/Lab.txt", FileMode.Create), Encoding.GetEncoding(1251));
binout.Write(b);
binout.Close();
// CP 866
byte[] c = { 0xAF, 0xE0, 0xA8, 0xA2, 0xA5, 0xE2 };
BinaryWriter binout1 = new BinaryWriter(new FileStream("C:/Users/sl/source/repos/Lab/Lab/bin/Debug/netcoreapp3.1/LabCP866.txt", FileMode.Create), Encoding.GetEncoding(866));
binout1.Write(c);
binout1.Close();
// КОИ8-R
byte[] d = { 0xD0, 0xD2, 0xC9, 0xD7, 0xC5, 0xD4 };
BinaryWriter binout2 = new BinaryWriter(new FileStream("C:/Users/sl/source/repos/Lab/Lab/bin/Debug/netcoreapp3.1/LabКОИ8-R.txt", FileMode.Create), Encoding.GetEncoding("KOI8-R"));
binout2.Write(d);
binout2.Close();
Хочу записать в файл “привет” на 1251, ср866 и КОИ8-R. На 1251 все записывается правильно, но на 866 и КОИ8-R выводит нечитаемые символы