Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@
### Bug Fixes

- [#806]: Properly normalize EOL characters in `Deserializer`.
- [#888]: Properly split attribute values by items when deserialize attribute into
list of values and attribute requires decoding.

### Misc Changes

[#806]: https://github.com/tafia/quick-xml/issues/806
[#878]: https://github.com/tafia/quick-xml/pull/878
[#882]: https://github.com/tafia/quick-xml/pull/882
[#888]: https://github.com/tafia/quick-xml/pull/888


## 0.38.0 -- 2025-06-28
Expand Down
3 changes: 2 additions & 1 deletion src/de/simple_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ impl<'de, 'a> SeqAccess<'de> for ListIter<'de, 'a> {
// Skip additional bytes if we own data for next iteration, but deserialize from
// the borrowed data from our buffer
Content::Owned(s, skip) => {
let item = s.split_at(skip + end).0;
let rest = s.split_at(skip).1;
let item = rest.split_at(end).0;
let result = seed.deserialize(AtomicDeserializer {
content: CowRef::Slice(item),
escaped: self.escaped,
Expand Down
35 changes: 35 additions & 0 deletions tests/serde-issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,3 +674,38 @@ fn issue868() {
),
}
}

/// Regression test for https://github.com/tafia/quick-xml/pull/888.
#[cfg(feature = "encoding")]
#[test]
fn issue888() {
#[derive(Debug, PartialEq, Deserialize)]
struct Root {
#[serde(rename = "@list")]
list: Vec<String>,
}

let xml = r#"
<?xml version="1.0" encoding="windows-1251"?>
<root list="текст требующий декодирования"/>"#;

let (xml, enc, _) = dbg!(encoding_rs::WINDOWS_1251.encode(xml));
assert_eq!(
enc,
encoding_rs::WINDOWS_1251,
"windows-1251 should be used for the test"
);

let data: Root = quick_xml::de::from_reader(xml.as_ref()).unwrap();
assert_eq!(
data,
Root {
list: vec![
// Translation from Russian:
"текст".to_string(), // text
"требующий".to_string(), // that-requires
"декодирования".to_string(), // decoding
],
}
);
}
Loading