Encoding, Decoding, and Random Access Handle
Explore encoding and decoding techniques for text in C# including ASCII, UTF-8, and UTF-16. Learn to use stream helpers for encoding text in files and practice reading and writing files with random access handles introduced in .NET 6. Understand how to efficiently store and retrieve text data across different encoding formats.
Text character representation
Text characters can be represented in different ways. For example, the alphabet can be encoded using Morse code into a series of dots and dashes for transmission over a telegraph line.
Text encoding in computer
Similarly, text inside a computer is stored as bits (ones and zeros) representing a code point within a code space. Most code points represent a single character but can have other meanings, such as formatting. For example, ASCII has a code space with code points. .NET uses a standard called Unicode to encode text internally. Unicode has more than one million code points.
Encoding in .NET
Sometimes, we will need to move text outside .NET for use by systems that do not use Unicode or a variation of Unicode, so it is important to learn how to convert between ...