diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 717fa2ca..652d1e20 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -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 @@ -7474,7 +7474,7 @@ namespace pugi if (!(flags & format_no_declaration) && !impl::has_declaration(_root)) { buffered_writer.write_string(PUGIXML_TEXT("'); if (!(flags & format_raw)) buffered_writer.write('\n'); }