Partilhar via


UseCodePage Property

Specifies whether the XMLAdapter object should use special logic to determine what code page should be used for encoding or decoding data. Read/write at design time and run time.

XMLAdapter.UseCodePage = lValue

Return Value

  • lValue
    Logical data type. The following table lists values for lValue.

    lValue Description

    False (.F.)

    (Default) See the table below for the effect of setting the UseCodePage property to False (.F.).

    True (.T.)

    See the table below for the effect of setting the UseCodePage property to True (.T.).

Remarks

Applies to: XMLAdapter Class

When the XMLAdapter UseCodePage property is True (.T.), the behavior of the ToCursor, ChangesToCursor, and ApplyDiffgram methods change as follows:

  • The XMLTable CodePage (or the XMLAdapter CodePage if the codepage is zero) is used as the code page for the new cursor unless the nCodePage parameter is passed.

  • When a field is populated, the XMLField CodePage (if zero, then the cursor’s code page) is used to decode data from Unicode. The XMLField CodePage does not have to be supported by Visual FoxPro. For example, code page 65001 can be used to decode data using UTF-8 code page.

The following table shows how the UseCodePage, RespectCursorCP, and UTF8Encoded property settings affect the ToXML method.

RespectCursorCP UTF8Encoded UseCodePage=.F. UseCodePage=.T.

False (.F.)

False (.F.)

The Windows 1252 code page is used as the encoding attribute for the XML document.

Character data is translated to the current default code page except for fields marked as NOCPTRANS. Unicode data is translated using code page 1252.

Identical to UseCodePage = .F.

True (.T.)

False (.F.)

The cursor’s code page is used as the encoding attribute for the XML document.

Character data is not translated and raw data from the table is used. Unicode data is translated using cursor’s code page.

Identical to UseCodePage = .F.

However, an error is generated if the XMLField CodePage is greater than zero and does not match cursor’s code page.

False (.F.)

True (.T.)

The UTF-8 code page is used as the encoding attribute for the XML document.

Character data is translated to the current default code page except for fields marked as NOCPTRANS, and no additional character translation to the UTF-8 code page occurs. Unicode data is translated using the UTF-8 code page.

Identical to UseCodePage = .F.

True (.T.)

True (.T.)

The UTF-8 code page is used as the encoding attribute for the XML document.

Character data is translated to the current default code page except for fields marked as NOCPTRANS. These fields are translated to UTF-8 using code page specified with the SYS(3005) - Set Locale ID. Unicode data is translated using UTF-8 code page.

The UTF-8 code page is used as the encoding attribute for the XML document. Raw character data from the table is translated to the UTF-8 code page using either the cursor’s code page or the XMLField CodePage if it is greater than zero. Unicode data is translated using the UTF-8 code page.

See Also

Reference

XMLAdapter Class
CodePage Property
RespectCursorCP Property
UTF8Encoded Property

Other Resources

Properties (Visual FoxPro)