Skip to main content

Crate teletex

Crate teletex 

Source
Expand description

§ITU-T Recommendation T.61 Teletex-to-Unicode

ITU-T Recommendation T.61 specifies the T.61 character set for use in an ancient telecommunications service called “Teletex.” For this reason, the words “Teletex” and “T.61” are often used interchangeably when talking about character encodings, including by the ITU-T themselves.

Teletex character encodings are scarcely used anymore, except in ASN.1 specifications, but even then, it appears in legacy ASN.1 protocols and even there, most implementations just treat Teletex as ASCII. This is mostly accurate, since the first 127 characters overlaps with ASCII, although some characters that are defined in ASCII are not defined in T.61.

§This crate

This crate is no_std and was not written in any part by AI or LLMs. This crate was fuzz-tested.

§Usage

To convert the bytes of a T.61 string into UTF-8, you should prefer to iterate character-by-character, if possible, so as to avoid any heap allocation, like so:

use teletex::teletex_to_utf8;
let input = b"Big\xA4Money\xA4";
for utf8char in teletex_to_utf8(input) {
    // ...utf8char is the UTF-8 equivalent
}

However, if you actually need an allocated string, you can do this:

let input = b"Big\xA4Money\xA4";
let output: String = teletex_to_utf8(input).collect();
assert_eq!(output.as_str(), "Big$Money$");

Structs§

TeletexToUnicodeChars
Iterator over the conversion of Teletex to UTF-8

Functions§

is_teletex_diacritic
Return true if the character c is a diacritic in Teletex
teletex_char_to_utf8_char
Convert a single Teletex character to its equivalent Unicode character
teletex_to_utf8
Convert Teletex to UTF-8, character by character.