Skip to main content

Posts

Showing posts from March, 2025

Using legacy text encodings in .NET Core

Upgrading an (old) .NET application to .NET core turned into a learning experience when we got the following error message after the upgrade was done: System.NotSupportedException : No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. TLDR; The application was using an older Windows-1252 text encoding causing the error above when trying to use this in .NET Core which doesn’t support this encoding out-of-the-box. Introduction to Text Encodings Text encoding is a method used to convert text data into a format that can be easily processed by computers. Computers inherently understand numbers, not characters, so text encoding maps characters to numerical values. This process ensures that text data can be stored, transmitted, and interpreted correctly across different systems and platforms. There are various text encodings, each designed to support different sets of characters. Some c...