Method XmlNode():setEncoding() Foundation

Sets the character encoding of the XML document.

:setEncoding( <cEncoding> ) --> self
A character string specifying the encoding used in the XML document. The string in <cEncoding> must conform to IANA character set naming.

:setEncoding() returns the object executing the method.


The method :setEncoding() is used to specify the character set used for encoding the XML document. The character encoding is part to the XML document declaration. Character sets often used for encoding XML documents are "UTF-8" and "ISO-8859-1" - "ISO-8859-9".

Character set names are case-insentive.

:setEncoding() can be called on any node of an XML document. The method then locates the document node for changing the encoding in the XML document definition. If the node object is not associated with any XML document, that is, if the node is a part of an XML graph without a document node, :setEncoding() raises a runtime error.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.