mirror of
https://github.com/zeux/pugixml.git
synced 2025-01-13 17:37:58 +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);
|
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
|
// BOM always represents the codepoint U+FEFF, so just write it in native encoding
|
||||||
#ifdef PUGIXML_WCHAR_MODE
|
#ifdef PUGIXML_WCHAR_MODE
|
||||||
@ -7474,7 +7474,7 @@ namespace pugi
|
|||||||
if (!(flags & format_no_declaration) && !impl::has_declaration(_root))
|
if (!(flags & format_no_declaration) && !impl::has_declaration(_root))
|
||||||
{
|
{
|
||||||
buffered_writer.write_string(PUGIXML_TEXT("<?xml version=\"1.0\""));
|
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('?', '>');
|
buffered_writer.write('?', '>');
|
||||||
if (!(flags & format_raw)) buffered_writer.write('\n');
|
if (!(flags & format_raw)) buffered_writer.write('\n');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user