windows-1251 encoding on C# mono project under Ubuntu 16.04

1.3k views Asked by At

my difficult life force me to use "windows-1251" encoding on C# under Ubuntu 16.04. I use "mono" to run C#.

both commands

 Encoding.GetEncoding(1251)
 Encoding.GetEncoding("windows-1251")

give this exception

System.NotSupportedException: Encoding 1251 data could not be found. Make sure you have correct international codeset assembly installed and enabled.
  at System.Text.Encoding.GetEncoding (System.Int32 codepage) [0x0023f] in <65984520577646ec9044386ec4a7b3dd>:0

According to this answer, I need to use

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

but my c# can't find "RegisterProvider". As far a I understood, I need to include "System.Text.Encoding.CodePages" manually. Some steps are described here in comments, but I can't understand where can I download it and how can I link it.

Could someone advice me how to include it (if it solves the problem) or tell me what to do in general.

0

There are 0 answers