CVS( ) |
Convert Internal Format of Data |
Convert String: |
CVS(data$, conversion$ [, text length ] [, ERR=stmtref] ) |
data$ |
Data to convert. String expression. |
conversion$ |
String that defines the input and output data formats. |
text length |
(Optional - Only applicable when converting to BASE64 or BASE64URL) |
stmtref |
Program line number or statement label to which to transfer control. |
This format of the CVS( ) function allows for rapid data transformation between two different internal formats such as normal ASCII and BASE64 or UUENCODE.
The CVS( ) function converts a string of data to different internal formats based on the values defined by conversion$, which is made up of two data definition values separated by a : (colon). The first data definition value defines the input format. The second defines the desired target format.
Example:
To convert normal ASCII to BASE64, the value in conversion$ would be:
"ASCII:BASE64"
Possible values for the input/output formats are:
Format |
Description | ||||||||||||||
ASCII |
Normal 8-bit data in ASCII format. The exact character set is based on the operating system currently in use. For most systems, this is ANSI (code table 1252 on Windows); however, when DBCS is enabled, use of ASCII will mean the current default character set. | ||||||||||||||
BASE64 |
The MIME e-mail format BASE64 is a binary to text encoding scheme whereby an arbitrary sequence of bytes is converted to a sequence of printable ASCII characters. The only characters used are the uppercase and lowercase alphabetic characters (A - Z, a - z), the numerals (0 - 9), and the "+" and "/" symbols, with the "=" symbol is a special suffix code. (BASE64URL is an industry recognized variant on BASE64 where the + and / characters are replaced with - and _ respectively). The BASE64ANY should only be used as an input specifier and will allow the system to accept either BASE64 or BASE64URL formatted data. If used on output, standard BASE64 is assumed. Full specifications for base64 are contained in RFC 1421 and RFC 2045. | ||||||||||||||
8-bit data represented by the industry assigned code page number nnnn. The following codesets are supported on all platforms: (as of PxPlus v8.11, build 9182)
Additional codepage are available on Windows and can be added to UNIX/Linux systems by creating conversion tables in the *plus/codepage directory. | |||||||||||||||
HSL |
When specified for the INPUT format, tries to convert input as three numeric values representing an HSL color code. If not valid, converts input as a standard color to HTML representation. On output, converts color to HSL value. (HSL support was added in PxPlus 2014.) | ||||||||||||||
HTML |
Standard 8-bit data that uses HTML encoding for <, >, and & as < > and & respectively. On output, converts all characters less than $20$ or greater than $7E$ to their respective &#xXX; form. On input, the HTML format will also replace most industry standard HTML Character Entity codes such as &trade; (™), &yen; (¥), or &copy; (©) with their respective UNICODE character equivalents. (HTML support was added in PxPlus 2017.) | ||||||||||||||
Same as URL but does not translate / (slash) to %2F. (LINK support was added in PxPlus 2020.) | |||||||||||||||
NATIVE |
When NATIVE is specified, the system will use either ASCII or UTF8, depending on the setting of the 'U8' system parameter. (UTF-8 is used when the parameter is non-zero.) | ||||||||||||||
Used to convert Quoted Printable text. By default, output of quoted printable text will wrap/break at 76 characters. When converting to QPRINT format, all end-of-line characters will be converted to the OS end-of-line characters; i.e. on Windows, a Carriage Return followed by Line Feed ($0d0a$), and on UNIX/Linux, a Line Feed ($0a$). The following conversion formats can also be used:
(QPRINT support was added in PxPlus 2017.) | |||||||||||||||
RGB |
When specified for the INPUT format, tries to convert input as three numeric values representing an RGB color code; if not valid, converts input as a standard color to HTML representation. On output, convert color to RGB value. (RGB support was added in PxPlus 2014.) | ||||||||||||||
RTF |
This can only be used as input (from) data format and tells the system to strip the RTF formatting information from the input, returning just the text. | ||||||||||||||
UNICODE |
Available on Windows and on UNIX/Linux. (As of PxPlus v9.10, build 9201) | ||||||||||||||
The URL Encode/Decode is used to convert characters that cannot be used in a Web-based URL to their appropriate hexadecimal equivalent with a leading % character. | |||||||||||||||
URL? |
Same as URL but does not translate either / (slash) or ? (question mark) until a ? is found in the string. After the ? (question mark), / (slash) becomes %2F and ? (question mark) becomes %1F as in the URL conversion. (URL? support was added in PxPlus 2020.) | ||||||||||||||
UTF8 |
Available on Windows and on UNIX/Linux. (As of PxPlus v9.10, build 9201) | ||||||||||||||
UUENCODE |
Uuencode repeatedly takes in a group of three bytes to create a 24-bit value that is split into four groups of six, which are treated as numbers between 0 and 63. Decimal 32 is added to each number and they are output as ASCII characters, which will be in the range 32 (space) to 32+63 = 95 (underscore). | ||||||||||||||
Standard 8-bit data that uses XML encoding for <, >, &, ', and " as < > & ' and " respectively. On output, converts all characters less than $20$ or greater than $7E$ to their respective &#xXX; form. Hex/Unicode characters will also be replaced. (as of PxPlus v8.30, build 9190.3) When the CDATA tag is used, data will be passed "as is" within CDATA. (CDATA support was added to XML conversion in PxPlus 2014.) |
(The extended CVS conversion functionality was added in PxPlus v7.00, build 9163.)