diff --git a/libs/stringtable/src/rapify.rs b/libs/stringtable/src/rapify.rs index 0797c248..43f4b30f 100644 --- a/libs/stringtable/src/rapify.rs +++ b/libs/stringtable/src/rapify.rs @@ -1,6 +1,6 @@ use crate::{Key, Project, ALL_LANGUAGES}; use hemtt_workspace::WorkspacePath; -use tracing::trace; +use tracing::{trace, warn}; #[derive(Default, Debug)] pub struct XmlbLayout { @@ -137,7 +137,12 @@ pub fn rapify(project: &Project) -> Option { i32::try_from(translation.phrases.len()).expect("overflow"), ); for phrase in &translation.phrases { - write_string(&mut translation_buffer, phrase); + let unescaped = quick_xml::escape::unescape(phrase.as_str()); + if unescaped.is_err() { + warn!("failed to unescape stringtable entry [{}]", phrase); + return None; + } + write_string(&mut translation_buffer, &unescaped.unwrap_or_default()); } rolling_offset += translation_buffer.len(); data.translations.push(translation_buffer);