[xml] xmlSaveFormatFileEnc() doesn't always write encoding declaration.



The xmlSaveFormatFileEnc function accepts a NULL for the encoding,
though the documentation doesn't say what that would mean:
http://xmlsoft.planetmirror.com/html/libxml-tree.html#xmlSaveFormatFileEnc

int     xmlSaveFormatFileEnc            (const char * filename, 
                                         xmlDocPtr cur, 
                                         const char * encoding, 
                                         int format)

It does seem to default to UTF-8 encoding when NULL is used, but NULL also 
means that the encoding declaration will not be written at the start of the 
XML file. Is that ever a good thing? It seems like a bug. Would it break 
anything to make it always write the encoding declaration? 

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]