Condividi tramite


UTF8Encoded Property

Specifies whether to set encoding to Unicode Transformation Format-8 (UTF-8). UTF8Encoded works in conjunction with the RespectCursorCP property.

UTF8Encoded applies only when executing the XMLAdapter ToXML method, which creates XML consistent with its setting.

XMLAdapter.UTF8Encoded [= lValue] 

Return Value

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

    lValue Description

    False (.F.)

    Does not set encoding to UTF-8. (Default)

    True (.T.)

    Sets encoding to UTF-8.

Remarks

Applies To: XMLAdapter Class

The default encoding for XML is UTF-8, whereas for Visual FoxPro, the default encoding is Windows-1252. When you want to output data to XML, you can preserve UTF-8 encoding by setting encoding to UTF-8 and instructing Visual FoxPro to translate double-byte characters to the proper UTF-8 encoding sequence.

If you have a group of characters representing Korean or Chinese text, you can convert those characters to double-byte character sets (DBCS) to view them in Visual FoxPro. You can then reconvert them to UTF-8 when transmitting them across the Web as XML so that other systems can correctly display the data.

For example, the following table describes how RespectCursorCP and UTF8Encoded interact with each other.

RespectCursorCP UTF8Encoded Conversion performed

False

False

Windows-1252 (Default)

True

False

Set output encoding attribute to the code page of the cursor.

False

True

Set output encoding attribute to UTF-8. No character translation occurs.

True

True

Set output encoding attribute to UTF-8. Translate character data to UTF-8.

True

False

Set output encoding attribute to the code page of the cursor.

See Also

Reference

XMLAdapter Object Properties, Methods, and Events
RespectCursorCP Property
ToXML Method

Other Resources

Properties (Visual FoxPro)