CharsetDetector / UTF-unknown

Character set detector build in C# - .NET 5+, .NET Core 2+, .NET standard 1+ & .NET 4+
303 stars 45 forks source link

NotSupportedException while trying GetEncoding #139

Closed jamesjohnmcguire closed 2 years ago

jamesjohnmcguire commented 2 years ago

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)
jamesjohnmcguire commented 2 years ago

Added PR #140 for this issue.

304NotModified commented 2 years ago

fixed by https://github.com/CharsetDetector/UTF-unknown/pull/146