I have created an XML tree using the XML package in R, when saving using 'saveXML' the encoding argument is ignored.
here is an example
xml1 <- xmlTree()
xml1$addTag("Data","Hello World")
saveXML(xml1,filepath, encoding = "UTF-8")
the result is as follows:
<?xml version="1.0"?>
<Data>Hello World</Data>
however I was expecting the top line to read:
<?xml version="1.0" encoding="UTF-8"?>
any help would be appreciated
helponsaveXMLand it seemsprefixattribute can be used to add that information. TrysaveXML(xml1,filepath, prefix = '<?xml version="1.0" encoding="UTF-8"?>\n'). Please read help to understand the explanation.ecoding = "UTF-8"notencoding = "UTF-8"