Commit 71418cc
committed
Fix xml_parse_result::encoding for empty document load
The new early-out for size==0 has a subtly different behavior from the
main path: encoding is left at auto instead of being set to the inferred
encoding (which is always UTF-8 for empty inputs).
In general, xml_parse_result::encoding is a bit inconsistent for error
returns: the parse() path sets it including errors, but other paths
don't. That said, this is somewhat defensible since there's some difference
between not having parsed anything and having parsed something.
In any case, before the early out, fragment parse of an empty document
would return UTF-8 encoding, so this change restores the behavior and
adds a test for it.1 parent 29b39be commit 71418cc
2 files changed
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4850 | 4850 | | |
4851 | 4851 | | |
4852 | 4852 | | |
4853 | | - | |
| 4853 | + | |
| 4854 | + | |
| 4855 | + | |
| 4856 | + | |
| 4857 | + | |
| 4858 | + | |
4854 | 4859 | | |
4855 | 4860 | | |
4856 | 4861 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1318 | 1318 | | |
1319 | 1319 | | |
1320 | 1320 | | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
1321 | 1330 | | |
1322 | 1331 | | |
1323 | 1332 | | |
| |||
0 commit comments