[][src]Crate esperanto_text

Convert Esperanto text between UTF-8, x-system and h-system transliterations.

When correctly printed, Esperanto text has various diacritics that can be properly represented in UTF-8. Those who are limited to ASCII or are unable to type these characters often resort to the "h-system" or "x-system". In these, a suffix is added to those letters which should have a diacritic.

This crate provides convenience functions for converting a string from one transliteration to another. For the x-system this can be done with complete accuracy as there is no ambiguity. For the h-system, a small vocabulary list is used to avoid changing the meaning of real words.

A binary called eotext is included to use these functions from a CLI.

Example: UTF-8 to x-system

let input = "eĥoŝanĝo ĉiuĵaŭde";
assert_eq!(
    esperanto_text::utf8_to_x_system(input),
    "ehxosxangxo cxiujxauxde".to_owned(),
);

Example: h-system to UTF-8

let input = "Chiuj estas senchavaj kaj taugaj ideoj.";
assert_eq!(
    esperanto_text::h_system_to_utf8(input),
    "Ĉiuj estas senchavaj kaj taŭgaj ideoj.".to_owned(),
);

Functions

h_system_to_utf8

Convert h-system "jhauhdo" to UTF-8 "ĵaŭdo"

utf8_to_x_system

Convert UTF-8 "ĵaŭdo" to x-system "jxauxdo"

utf8_to_h_system

Convert UTF-8 "ĵaŭdo" to h-system "jhaudo"

x_system_to_utf8

Convert x-system "jxauxdo" to UTF-8 "ĵaŭdo"