diff --git a/FAQ.md b/FAQ.md index 66212223b6..0f7a5c6872 100644 --- a/FAQ.md +++ b/FAQ.md @@ -5,6 +5,7 @@ ### General * [Are MimeKit and MailKit completely free? Can I use them in my proprietary product(s)?](#completely-free) +* [Why am I getting `NotSupportedException: No data is available for encoding ######. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.`?](#register-provider) ### Messages @@ -33,6 +34,19 @@ Yes. MimeKit and MailKit are both completely free and open source. They are both covered under the [MIT](https://opensource.org/licenses/MIT) license. +### Q: Why am I getting `NotSupportedException: No data is available for encoding ######. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.`? + +In .NET Core, Microsoft decided to split out the non-Unicode text encodings into a separate NuGet package called +[System.Text.Encoding.CodePages](https://www.nuget.org/packages/System.Text.Encoding.CodePages). + +MimeKit already pulls in a reference to this NuGet package, so you shsouldn't need to add a reference to it in +your project. That said, you will still need to register the encoding provider. It is recommended that you add +the following line of code to your program initialization (e.g. the beginning of your program's Main() method): + +```csharp +System.Text.Encoding.RegisterProvider (System.Text.CodePagesEncodingProvider.Instance); +``` + ## Messages ### Q: How do I create a message with attachments?