getEncoding.RdThis function and its methods are intended to return the
encoding of n XML .
It is similar to Encoding but currently
restricted to XML nodes and documents.
getEncoding(obj, ...)A character vector of length 1 giving the encoding of the XML document.
f = system.file("exampleData", "charts.svg", package = "XML")
doc = xmlParse(f)
getEncoding(doc)
#> [1] "ISO-8859-1"
n = getNodeSet(doc, "//g/text")[[1]]
getEncoding(n)
#> [1] "ISO-8859-1"
f = system.file("exampleData", "iTunes.plist", package = "XML")
doc = xmlParse(f)
getEncoding(doc)
#> [1] "UTF-8"