work
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 9 Dec 2025 01:56:19 +0000 (17:56 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 9 Dec 2025 01:56:19 +0000 (17:56 -0800)
rust/pspp/Cargo.toml
rust/pspp/src/output/pivot/look_xml.rs
rust/pspp/src/output/spv/html.rs

index 82a0c51624fd2b6b5e27b7ccc7d63c95ada2d987..ee99cfce76cb0b21a0b210a62f6b9af42775fa00 100644 (file)
@@ -30,7 +30,7 @@ libm = "0.2.11"
 smallstr = "0.3.0"
 itertools = "0.14.0"
 unicode-linebreak = "0.1.5"
-quick-xml = { version = "0.38.4", features = ["serialize"] }
+quick-xml = { version = "0.38.4", features = ["serialize", "escape-html"] }
 serde = { version = "1.0.218", features = ["derive", "rc"] }
 color = { version = "0.2.3", features = ["serde"] }
 binrw = "0.14.1"
index 85bc1186a3c66793c3966179fced1af0ffe9f8b8..1c3c64d0316212e44f70da8fe1bfade16760af58 100644 (file)
@@ -781,7 +781,7 @@ mod tests {
                         underline: false,
                         font: String::from("Sans Serif"),
                         fg: Color::BLACK,
-                        bg: Color::BLACK,
+                        bg: Color::WHITE,
                         size: 9,
                     },
                 },
index 6515b07f18f5e6a0d42b15b311b377bc333a5589..4db98918fc49a758d3ff5b23628d4f1b06022b16 100644 (file)
@@ -914,4 +914,12 @@ mod tests {
             r##"<p align="right"><font color="#000000"><font face="sans-serif">Page &amp;[Page]</font></font></p>"##
         );
     }
+
+    /// Checks that the `escape-html` feature is enabled in [quick_xml], since
+    /// we need that to resolve `&nbsp;` and other HTML entities.
+    #[test]
+    fn html_escapes() {
+        let html = Document::from_html("&nbsp;");
+        assert_eq!(html.to_html(), "<p align=\"left\">\u{a0}</p>")
+    }
 }