ENCODING attribute

Returns the name of the character encoding used to encode the contents of an XML document. The default encoding is UTF-8.

Data type: CHARACTER

Access: Readable/Writable

Applies to: X-document object handle, SAX-writer object handle

For an X-document object, the AVM sets the ENCODING attribute to the encoding name specified in the XML document's encoding declaration when you load an XML document using the LOAD( ) method (Handle).

You can also set the ENCODING attribute to the name of the character encoding to use when saving an XML document using the SAVE( ) method. The AVM records this character encoding in the encoding declaration in the XML document's prologue. If you do not set the ENCODING attribute, when you save the document, the document will not have an encoding declaration in its prologue, but the document will be saved with the default encoding of UTF-8.

For a SAX-writer object, you can set the ENCODING attribute to the name of the character encoding to use when writing the XML document. You can set this attribute only when the WRITE-STATUS is either SAX-WRITE-IDLE or SAX-WRITE-COMPLETE. That is, you can only change this attribute when the writer is not writing, otherwise it fails and generates an error message. The AVM records this character encoding in the encoding declaration in the XML document's prologue. If you do not set the ENCODING attribute, when you write the document, the document will not have an encoding declaration in its prologue, but the document will be written with the default encoding of UTF-8.

The encoding name must be an Internet Assigned Numbers Authority (IANA) name supported by the ABL XML Parser. The following table lists the names of the supported IANA encodings and their corresponding ABL code pages.

IANA encodings and corresponding ABL code pages
IANA encoding name ABL code page name
Big5 BIG-5
EUC-JP EUCJIS
GB_2312-80 GB2312
GB18030 GB18030
GBK CP936
hp-roman8 ROMAN-8
IBM00858 IBM858
IBM037 IBM037
IBM273 IBM273
IBM277 IBM277
IBM278 IBM278
IBM284 IBM284
IBM297 IBM297
IBM437 IBM437
IBM500 IBM500
IBM850 IBM850
IBM851 IBM851
IBM852 IBM852
IBM857 IBM857
IBM861 IBM861
IBM862 IBM862
IBM866 IBM866
ISO-8859-1 ISO8859-1
ISO-8859-2 ISO8859-2
ISO-8859-3 ISO8859-3
ISO-8859-4 ISO8859-4
ISO-8859-5 ISO8859-5
ISO-8859-6 ISO8859-6
ISO-8859-7 ISO8859-7
ISO-8859-8 ISO8859-8
ISO-8859-9 ISO8859-9
ISO-8859-10 ISO8859-10
ISO-8859-15 ISO8859-15
KOI8-R KOI8-R
KS_C_5601-1987 KSC5601
Shift_JIS SHIFT-JIS
TIS-620 620-2533
US-ASCII -cpinternal
UTF-16 UTF-16
UTF-32 UTF-32
UTF-8 UTF-8
windows-1250 1250
windows-1251 1251
windows-1252 1252
windows-1253 1253
windows-1254 1254
windows-1255 1255
windows-1256 1256
windows-1257 1257
windows-1258 1258