diff --git a/rslib/i18n/src/lib.rs b/rslib/i18n/src/lib.rs index 0000738cc..030924547 100644 --- a/rslib/i18n/src/lib.rs +++ b/rslib/i18n/src/lib.rs @@ -422,6 +422,10 @@ pub struct ResourcesForJavascript { resources: Vec, } +pub fn without_unicode_isolation(s: &str) -> String { + s.replace("\u{2068}", "").replace("\u{2069}", "") +} + #[cfg(test)] mod test { use unic_langid::langid; diff --git a/rslib/src/media/check.rs b/rslib/src/media/check.rs index d7adfa361..d94203721 100644 --- a/rslib/src/media/check.rs +++ b/rslib/src/media/check.rs @@ -25,6 +25,8 @@ use crate::{ text::{extract_media_refs, normalize_to_nfc, MediaRef, REMOTE_FILENAME}, }; +use anki_i18n::without_unicode_isolation; + #[derive(Debug, PartialEq, Clone)] pub struct MediaCheckOutput { pub unused: Vec, @@ -125,7 +127,9 @@ where buf += &i.media_check_renamed_header(); buf.push('\n'); for (old, new) in &output.renamed { - buf += &i.media_check_renamed_file(old.as_str(), new.as_str()); + buf += &without_unicode_isolation( + &i.media_check_renamed_file(old.as_str(), new.as_str()), + ); buf.push('\n'); } buf.push('\n') @@ -136,7 +140,7 @@ where buf += &i.media_check_oversize_header(); buf.push('\n'); for fname in &output.oversize { - buf += &i.media_check_oversize_file(fname.as_str()); + buf += &without_unicode_isolation(&i.media_check_oversize_file(fname.as_str())); buf.push('\n'); } buf.push('\n') @@ -147,7 +151,7 @@ where buf += &i.media_check_subfolder_header(); buf.push('\n'); for fname in &output.dirs { - buf += &i.media_check_subfolder_file(fname.as_str()); + buf += &without_unicode_isolation(&i.media_check_subfolder_file(fname.as_str())); buf.push('\n'); } buf.push('\n') @@ -158,7 +162,7 @@ where buf += &i.media_check_missing_header(); buf.push('\n'); for fname in &output.missing { - buf += &i.media_check_missing_file(fname.as_str()); + buf += &without_unicode_isolation(&i.media_check_missing_file(fname.as_str())); buf.push('\n'); } buf.push('\n') @@ -169,7 +173,7 @@ where buf += &i.media_check_unused_header(); buf.push('\n'); for fname in &output.unused { - buf += &i.media_check_unused_file(fname.as_str()); + buf += &without_unicode_isolation(&i.media_check_unused_file(fname.as_str())); buf.push('\n'); } }