CharsetDetector / UTF-unknown

Character set detector build in C# - .NET 5+, .NET Core 2+, .NET standard 1+ & .NET 4+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NotSupportedException while trying GetEncoding

jamesjohnmcguire opened this issue · comments

at src/DetectionDetail.cs, line 98.

The exception message is "NotSupportedException:
Support for UTF-7 is disabled. See https://aka.ms/dotnet-warnings/SYSLIB0001 for more information.

I'm pretty sure this happened on a corrupted buffer, probably with some binary data. I can no longer find a reproducible test case. But, it did lead to add a catch for NotSupportedException, as well, at line 100. Such as:

        catch (Exception exception) when
            (exception is ArgumentException || // unsupported name
            exception is NotSupportedException)

Added PR #140 for this issue.