Skip to content

Commit 30cc354

Browse files
authored
Merge pull request #621 from aral-matrix/master
xmldocument::save: use encoding interpreted by get_write_encoding in buffered_writer constructor
2 parents 2d42114 + 2039e44 commit 30cc354

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pugixml.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7460,7 +7460,7 @@ namespace pugi
74607460
{
74617461
impl::xml_buffered_writer buffered_writer(writer, encoding);
74627462

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

0 commit comments

Comments
 (0)