From 1452dc5a623b86f50b2cc39e79ff192e18dceff3 Mon Sep 17 00:00:00 2001 From: Sammi De Guzman Date: Fri, 1 Jan 2021 02:08:10 -0800 Subject: [PATCH] Write non-ASCII steno strokes to escapes as well --- src/dict.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dict.rs b/src/dict.rs index b410355..fd49675 100644 --- a/src/dict.rs +++ b/src/dict.rs @@ -47,7 +47,10 @@ impl Entry { pub fn write(&self, writer: &mut dyn io::Write) -> Result<(), io::Error> { write!(writer, "{{\\*\\cxs {}}}{}{}\n", - self.steno, format_plover_to_rtf(&self.translation), + self.steno.chars().map(|c| + if (c as u32) > 255 { format!("\\u{} ", c as u32) } + else { String::from(c) }).collect::>().join(""), + format_plover_to_rtf(&self.translation), match &self.metadata { Some(EntryMetadata { comment: Some(comment) }) => format!("{{\\*\\cxcomment {}}}", comment),