mirror of
https://github.com/zeux/pugixml.git
synced 2024-12-25 20:14:10 +08:00
Merge pull request #621 from aral-matrix/master
xmldocument::save: use encoding interpreted by get_write_encoding in buffered_writer constructor
This commit is contained in:
commit
30cc354fe3
@ -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("<?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');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user