dittodhole / dotnet-Svg.Contrib.Render

Other
26 stars 5 forks source link

CreateFingerPrintRenderer exception on example (System.NotSupportedException) #22

Open tinohager opened 3 years ago

tinohager commented 3 years ago

Hi i have try the example but it throw an exception. I think it is not a problem with my svg file`, at this position was not yet used the image. I use .NET 5.

image

tinohager commented 3 years ago

Ok it is a problem with the unavailable encoding. Resgister the Provider before fix the issue.

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
dittodhole commented 3 years ago

fyi - this has changed according to https://docs.microsoft.com/en-us/dotnet/api/system.text.encoding.registerprovider#remarks

Starting with .NET Framework 4.6, .NET Framework includes one encoding provider, CodePagesEncodingProvider, that makes the encodings available that are present in the full .NET Framework but are not available in the Universal Windows Platform. By default, the Universal Windows Platform only supports the Unicode encodings, ASCII, and code page 28591.

additionally see https://docs.microsoft.com/en-us/dotnet/api/system.text.codepagesencodingprovider#remarks

The .NET Framework for the Windows desktop supports a large set of Unicode and code page encodings. .NET Core, on the other hand, supports only the following encodings [...]

... and 850, as used in https://github.com/dittodhole/dotnet-Svg.Contrib.Render/blob/9308b5c5f793d1b5531529056f740367a33d5ce2/src/Svg.Contrib.Render.FingerPrint/FingerPrintRenderer.cs#L152, is not listed :(

you might encounter duplicate exceptions with:

dittodhole commented 3 years ago

I'll have a look at this, and try to workaround the NotSupportedException by checking the existance of encodings.

tinohager commented 3 years ago

@dittodhole Hello, unfortunately I have not found a direct contact way so I contact you through this way. It also annoys me that there is still no better solution to print. That is why I have now joined the project https://github.com/BinaryKits/BinaryKits.Zpl. Maybe you are also interested in working here.