Skip to content

Commit

Permalink
Merge pull request zeux#621 from aral-matrix/master
Browse files Browse the repository at this point in the history
xmldocument::save: use encoding interpreted by get_write_encoding in buffered_writer constructor
  • Loading branch information
zeux committed Jul 8, 2024
2 parents 2d42114 + 2039e44 commit 30cc354
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pugixml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7460,7 +7460,7 @@ namespace pugi
{
impl::xml_buffered_writer buffered_writer(writer, encoding);

if ((flags & format_write_bom) && encoding != encoding_latin1)
if ((flags & format_write_bom) && buffered_writer.encoding != encoding_latin1)
{
// BOM always represents the codepoint U+FEFF, so just write it in native encoding
#ifdef PUGIXML_WCHAR_MODE
Expand All @@ -7474,7 +7474,7 @@ namespace pugi
if (!(flags & format_no_declaration) && !impl::has_declaration(_root))
{
buffered_writer.write_string(PUGIXML_TEXT("<?xml version=\"1.0\""));
if (encoding == encoding_latin1) buffered_writer.write_string(PUGIXML_TEXT(" encoding=\"ISO-8859-1\""));
if (buffered_writer.encoding == encoding_latin1) buffered_writer.write_string(PUGIXML_TEXT(" encoding=\"ISO-8859-1\""));
buffered_writer.write('?', '>');
if (!(flags & format_raw)) buffered_writer.write('\n');
}
Expand Down

0 comments on commit 30cc354

Please sign in to comment.