/ITA1

C# encoding for International Telegraph Alphabet no 1 (ITA1), a standardized version of the Baudot code.

Primary LanguageC#MIT LicenseMIT

ITA1 🔠

NuGet Version .NET

This project contains a derived C# class of System.Text.Encoding for the original version of International Telegraph Alphabet no 1 (ITA1) (aka Baudot Code).

Table of Contents

Prerequisites

Building

Use Visual Studio 2022 to build the project.

Installation

Get the NuGet package from nuget.org or search for MichelMichels.Text.ITA1 in the GUI package manager in Visual Studio.

You can also use the cli of the package manager with following command:

Install-Package MichelMichels.Text.ITA1


Usage

Warning

This is an opinionated project and as such, I made the decision of not allowing lowercase letters. This decision has the consequence that lowercase characters will not be converted to their equivalent uppercase character encoded byte, they will just be left out. This leads to loss of data when encoding and decoding.

Below is a short example on how to use this Ita1Encoding class.

using MichelMichels.Text;

Encoding ita1 = new Ita1Encoding();

// Encoding characters
byte[] bytes = ita1.GetBytes("HELLO WORLD");

// Decoding bytes
string value = ita1.GetString([0x0B, 0x02, 0x1B, 0x1B, 0x07, 0x10, 0x16, 0x07, 0x1C, 0x1B, 0x0F]);

Following example writes and reads text encoded in ITA1 to and from a text file.

using MichelMichels.Text;

Encoding ita1 = new Ita1Encoding();

// Writing
File.WriteAllText("output.txt", "HELLO WORLD", ita1);

// Reading
string data = File.ReadAllText("output.txt", ita1);

Credits