Partager via


SYS(2300) - Add or Remove Code Page

Adds or removes a code page from the National Language Support (NLS) list.

SYS(2300, nCodePage [, nAction])

Parameters

  • nCodePage
    Specifies the integer code page value.

  • nAction
    Specifies the action to perform on the specified code page. 0 removes the code page; 1 adds the code page.

Return Value

Character. SYS(2300) returns 1 if nCodePage appears in the NLS list; otherwise, it returns 0.

Remarks

When a code page is included in the list of those supported by Visual FoxPro, NLS routines are employed for proper indexing, string comparisons, collate keying, and so on. With certain collate sequences (for example, Russian, Czech, or Hungarian), string comparisons can result in unexpected values, depending on which code page is set. To make sure these operations proceed correctly you can use SYS(2300) in your applications to determine whether the correct code page is set.

If you create indexes after using SYS(2300) to enable NLS support for a specific code page, you will get odd behavior in previous versions of Visual FoxPro which do not have NLS support for that code page. Make sure all Visual FoxPro data access is made from clients with SYS(2300) configured in a similar manner.

The NLS list includes 874, 932, 936, 949, 950, 1255, and 1256. For more information, see Code Pages Supported by Visual FoxPro.

Example

Code page 1250 is not included in the NLS list by default. Therefore, certain string comparisons might return unexpected values. To demonstrate this, follow these steps:

  1. Enable code page support for non-NLS code page 1250 by adding the following line to your config.fpw file:

    CODEPAGE = 1250
    
  2. Restart Visual FoxPro.

  3. Run the following code from a program file:

    SET COLLATE TO 'HUNGARY'  && Requires CODEPAGE = 1250 in config file
    CLEAR
    
    ? UPPER("B")=LOWER("B"), LOWER("B")=UPPER("B")
    ? UPPER("F")=LOWER("F"), LOWER("F")=UPPER("F")
    ? UPPER("H")=LOWER("H"), LOWER("H")=UPPER("H")
    
    =SYS(2300,1250,1)  && Add code page 1250 to NLS list
    
    ? UPPER("B")=LOWER("B"), LOWER("B")=UPPER("B")
    ? UPPER("F")=LOWER("F"), LOWER("F")=UPPER("F")
    ? UPPER("H")=LOWER("H"), LOWER("H")=UPPER("H")
    
    =SYS(2300,1250,0)  && Restore default setting for code page 1250
    RETURN
    

With the default settings, LOWER("B")=UPPER("B"), LOWER("F")=UPPER("F"), and LOWER("H")=UPPER("H") return .T..

After enabling NLS support for code page 1250, LOWER("B")=UPPER("B"), LOWER("F")=UPPER("F"), and LOWER("H")=UPPER("H") return .F..

See Also

Reference

CPCURRENT( ) Function

CPCONVERT( ) Function

CPDBF( ) Function

SET COLLATE Command

SET CPDIALOG Command

SYS( ) Functions Overview