Skip to content

Commit

Permalink
use encoding interpreted by get_write_encoding in buffered_writer con…
Browse files Browse the repository at this point in the history
…structor
  • Loading branch information
aral-matrix committed Jul 7, 2024
1 parent 2d42114 commit 2039e44
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 2039e44

Please sign in to comment.