CodePage Property

Specifies the character set used for encoding or decoding an object. For the File object, the property is read-only. For XML objects, the property is read-write at design time and run time.

oXMLAdapter.CodePage = nValue
oXMLTable.CodePage = nValue
oXMLField.CodePage = nNvalue
oFileObject.CodePage

Return Value

  • oXMLAdapter, oXMLTable, oXMLField
    XML objects that support code pages.

  • oFileObject
    Object representing a file in a Visual FoxPro project.

  • nValue
    Numeric value associated with a code page. For XML objects, the default value is zero (0).

Remarks

Applies To: XMLAdapter Class, XMLTable Class, XMLField Class, File Object (Visual FoxPro)

A numeric value indicates the character set used for the object. Code pages usually correspond to different platforms and languages and are used in international applications.

When you use the LoadXML or Attach methods to load an XML document, the XMLAdapter object processes the XML to determine the CodePage property. If the XMLAdapter object is unable to determine the code page or the code page is not on the list of supported code pages, the CodePage property is set to zero (0).

For more information on code pages and international support in Visual FoxPro, see Code Pages Supported by Visual FoxPro and Developing International Applications.

Example

This example counts how many project files are using code page 1252 (ANSI Windows).

nCode1252=0
MODIFY PROJECT myproject NOWAIT
FOR i = 1 TO _VFP.ActiveProject.Files.Count
   IF  _VFP.ActiveProject.Files(i).CodePage = 1252
      nCode1252=nCode1252+1
   ENDIF
ENDFOR
?nCode1252    && Show the count in the Visual FoxPro screen.

See Also

Reference

CPCONVERT( ) Function

CPCURRENT( ) Function

CPDBF( ) Function

XMLAdapter Class

XMLTable Class

XMLField Class

LoadXML Method

Other Resources

Properties (Visual FoxPro)

Language Reference (Visual FoxPro)