Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance) does not add extra encoding providers

$
0
0

I am developing a netcoreapp2.0 console application and I need access to the whole encoding package from .NET.

I have already added the System.Text.Encoding.CodePages Version=4.4.0 Nuget package from this page to my project and cleaned/restored the project several time.

However I can't get the extra encoding I need.

The following code:

Console.WriteLine(Encoding.GetEncodings().Length);
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Console.WriteLine(Encoding.GetEncodings().Length);

returns:

8
8

and no extra encoding is added to Encoding class.

These are all the references I have in my project:

<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.0.0" />
<PackageReference Include="System.Data.HashFunction.xxHash" Version="2.0.0-ci-00012" />
<PackageReference Include="Nager.PublicSuffix" Version="1.1.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" />

<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />

Am I doing something wrong here?

Update

After reinstalling the .NET Core SDK 2.0.2 again, things started to work fine and I can use the extended Encoding code pages using Encoding.GetEncoding() method, however the Encoding.GetEncodings() still returns the initial 8 Encoding code pages.


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>