pub use saturnus_objects::charset::{NamedChar, decode, named_chars, to_trigraphs, trigraph_at};
use crate::{Error, Result};
pub fn encode(text: &str) -> Result<Vec<u8>> {
saturnus_objects::charset::encode(text).map_err(Error::Charset)
}
pub fn encode_command(text: &str) -> Result<Vec<u8>> {
saturnus_objects::charset::encode_command(text).map_err(Error::Charset)
}
#[cfg(test)]
#[allow(clippy::unwrap_used, clippy::expect_used)]
mod tests {
use super::*;
#[test]
fn errors_name_the_character() {
assert!(matches!(encode("€"), Err(Error::Charset('€'))));
assert!(matches!(encode_command("\\-> €"), Err(Error::Charset('€'))));
assert_eq!(encode("x\u{0304}y").unwrap(), b"\x81y");
assert_eq!(encode_command("\\->STR").unwrap(), b"\x8dSTR");
}
}