CPConvert(), CPCurrent(), CPDBF(), IDXCollate(), Set Collate, Set("Collate"), Set NoCPTrans
This slew of functions allows Visual FoxPro to manipulate variables, tables and indexes in a multiple-code-page environment.
Usage |
cResult = CPConvert( cFromCP, cToCP, cText ) |
Parameter |
Value |
Meaning |
cFromCP |
Integer |
Original code page from which cText is to be translated. |
cToCP |
Integer |
Destination code page for result. |
cText |
Character or memo |
Text to be translated. |
cResult |
Character |
Text after translation. |
Example |
WAIT WINDOW CPCONVERT(437,1252,"Jos"+CHR(130)) |
Usage |
nCodePage = CPCurrent( nWhichOne ) |
Parameter |
Value |
Meaning |
nWhichOne |
Omitted or 1 |
In Windows, the Windows code page; in other FoxPro platforms, the operating system's code page. |
2 |
In Windows, the underlying (MS-DOS) code page. In the other platforms, this should return the same as 1. |
|
nCodePage |
Numeric |
Number of the code page requested. |
Example |
? CPCURRENT(2) && what's the MS-DOS code page? |
Usage |
nCodePage = CPDBF( [ cAlias | nWorkArea ] ) |
Parameter |
Value |
Meaning |
cAlias |
Character |
Alias of the table whose code page is to be returned. |
Omitted |
If nWorkArea is also omitted, use the table in the current work area. |
|
nWorkArea |
Integer |
Work area number of the table whose code page is to be returned. |
Omitted |
If cAlias is also omitted, use the table in the current work area. |
|
nCodePage |
Numeric |
Number of the code page requested. |
Example |
* The Wizard table should be flagged for US Windows codepage DO CPZERO WITH HOME()+"\Wizards\Wizard.DBF",1252 USE Wizard.DBF IN 0 ALIAS DaWiz ? CPDBF("DaWiz") && should return 1252 |
Usage |
cCollation = IDXCollate( [cCDXName, ] nIndexNumber [, cAlias | nWorkArea ] ) |
Parameter |
Value |
Meaning |
cCDXName |
Character |
The name of the compound index file to examine. If no file is specified, IDXCollate() works on currently open indexes. |
nIndexNumber |
Integer |
As is typical of index functions, this refers to a number assigned to each open stand-alone index, in the order they were opened, then the tags of the structural index, then any other compound indexes open, with each tag enumerated in the order created. |
cAlias |
Character |
Alias of the table whose index collation is to be returned. |
Omitted |
If nWorkArea is also omitted, use the table in the current work area. |
|
nWorkArea |
Integer |
Work area number of the table whose index collation is to be returned. |
Omitted |
If cAlias is also omitted, use the table in the current work area. |
|
cCollation |
Empty string |
The number of the index specified exceeds the number of open indexes, or the work area number specified has no open file. |
Character |
The collation sequence which applies to this index. |
Example |
USE HOME() + "\Wizards\BuilderD.DBF" ? IDXCOLLATE(1) && returns "MACHINE" |
Usage |
SET COLLATE TO cSequence cSequence = SET( "COLLATE" ) |
Parameter |
Value |
Meaning |
cSequence |
Character |
Specifies the sequence in which items should be sorted. |
All collation sequences except Machine use 2 bytes per key so the maximum size of a key expression is only 120 bytes, not 240 as Help states. |
Example |
SET COLLATE TO "GENERAL" |
Usage |
SET NOCPTRANS to cFieldList cFieldList = SET( "NOCPTRANS" ) |
See Also |