avm1: Fix XML=>String coercion mangling non-ascii chars

Fixes #12859
This commit is contained in:
nosamu 2023-08-22 03:01:18 -05:00 committed by Nathan Adams
parent 2f40f0093a
commit 20b07ff147
4 changed files with 8 additions and 3 deletions

View File

@ -456,7 +456,7 @@ impl<'gc> XmlNode<'gc> {
result.push_byte(b' ');
result.push_str(&key);
result.push_str(WStr::from_units(b"=\""));
result.push_str(WStr::from_units(value.as_bytes()));
result.push_utf8(&value);
result.push_byte(b'"');
}
@ -480,7 +480,7 @@ impl<'gc> XmlNode<'gc> {
let value = self.0.read().node_value.unwrap();
let value = value.to_utf8_lossy();
let value = escape(&value);
result.push_str(WStr::from_units(value.as_bytes()));
result.push_utf8(&value);
}
Ok(())

View File

@ -1,8 +1,13 @@
<test />
I&apos;m a <b>text node</b>!
<продукция>Название_Name</продукция>
<test><test2 /></test>
I&apos;m a <b>text node</b>!
<продукция>Название_Name</продукция>
<test><test2>&quot;Test&quot; Node 2</test2></test>
I&apos;m a <b>text node</b>!
<продукция>Название_Name</продукция>
<newNodeName><test><test2>&quot;Test&quot; Node 2</test2></test>
I&apos;m a <b>text node</b>!</newNodeName>
I&apos;m a <b>text node</b>!
<продукция>Название_Name</продукция></newNodeName>
<продукция>Название_Name</продукция>