Runtime: Encoding.GetEncoding("windows-1251") throws

Created on 15 Apr 2016  路  2Comments  路  Source: dotnet/runtime

In universal windows app, calling Encoding.GetEncoding("windows-1251") will throw an exception

An exception of type 'System.ArgumentException' occurred in mscorlib.ni.dll but was not handled in user code

Additional information: 'windows-1251' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.

same for euc-kr charset.

Most helpful comment

You will likely need to reference the System.Text.Encoding.CodePages package and then use Encoding.RegisterProvider.

This Stack Overflow answer addresses a similar problem. I expect the answer will work for you as well.

The reason this is done was to remove the need to carry encoding data with ever UWP app, even if the apps did not use them.

All 2 comments

You will likely need to reference the System.Text.Encoding.CodePages package and then use Encoding.RegisterProvider.

This Stack Overflow answer addresses a similar problem. I expect the answer will work for you as well.

The reason this is done was to remove the need to carry encoding data with ever UWP app, even if the apps did not use them.

Got it. Thanks!

Was this page helpful?
0 / 5 - 0 ratings