@@ -29,6 +29,7 @@ use std::fs::File;
2929use std::io::{Read, Seek, SeekFrom, Write};
3030use std::path::{Path, PathBuf};
3131use std::sync::{LazyLock, Mutex};
32+ use unicode_normalization::UnicodeNormalization;
3233
3334type VmStrong<'gc, T> = Gc<'gc, GcCell<T>>;
3435type VmWeak<'gc, T> = GcWeak<'gc, GcCell<T>>;
@@ -30179,8 +30180,15 @@ impl<'gc> VM<'gc> {
3017930180 };
3018030181 match form.as_str() {
3018130182 "NFC" | "NFD" | "NFKC" | "NFKD" => {
30182- // Return the string as-is (basic implementation without ICU)
30183- return Value::String(s.to_vec());
30183+ let source = crate::unicode::utf16_to_utf8(s);
30184+ let normalized = match form.as_str() {
30185+ "NFC" => source.nfc().collect::<String>(),
30186+ "NFD" => source.nfd().collect::<String>(),
30187+ "NFKC" => source.nfkc().collect::<String>(),
30188+ "NFKD" => source.nfkd().collect::<String>(),
30189+ _ => unreachable!(),
30190+ };
30191+ return Value::String(crate::unicode::utf8_to_utf16(&normalized));
3018430192 }
3018530193 _ => {
3018630194 let err = self.make_range_error_object(
0 commit comments