| |
Encode the contents of the specified file.
Syntax
object.EncodeFile( InputFile,
OutputFile, Encoding )
Parameters
- InputFile
- A string value that specifies the name of the file to be encoded. The file must
exist, and it must be a regular file that can be opened for reading
by the current process. An error will be returned if a character
device, such as CON: is specified as the file name.
- OutputFile
- A string value that specifies the name of the file that will contain the encoded data.
If the file exists, it must be a regular file that can be opened
for writing by the current process and will be overwritten. If the
file does not exist, it will be created. An error will be returned
if a character device, such as CON: is specified as the file
name.
- Encoding
- The encoding algorithm to be used when creating the file. The
following encoding algorithms are valid:
| Value |
Description |
| fileEncodeDefault |
Use the default encoding method. Currently this is the same
specifying that the base64 algorithm should be used for
encoding and decoding files. |
| fileEncodeBase64 |
Use the Base64 algorithm, a widely supported method for
encoding binary data as text. It is the standard used by most
modern email clients and web applications. This is the default
encoding algorithm and should be used by most applications. |
| fileEncodeQuoted |
Use the quoted-printable encoding scheme, which encodes only
non-printable characters. Often used in email messages to
preserve text readability while ensuring compatibility. This
algorithm should only be used when the content is primarily text
which may include some 8-bit characters. Do not use this
algorithm to encode large amounts of binary data. |
| fileEncodeUucode |
Use the uuencode algorithm, a legacy encoding format
traditionally used on UNIX systems and in early email software.
This option is primarily included for compatibility with older
applications. This algorithm should not be used with new
applications. |
| fileEncodeYencode |
Use the yEnc algorithm, a compact encoding method commonly
used for binary file attachments in Usenet newsgroups. It offers
higher efficiency than traditional uuencode or Base64. This
algorithm is primarily used with USENET newsgroups. |
| fileEncodeBase58 |
Use the Base58 algorithm, which produces a compact,
human-readable encoded string. Commonly used for short binary
identifiers such as cryptocurrency addresses. This algorithm
should not be used with large files. Refer to the remarks below
for more information about Base58. |
| fileEncodeBase32 |
Use the Base32 algorithm, which encodes binary data into a
limited set of 32 alphanumeric characters. Commonly used in systems
where case-insensitive encoding is required or where data may be
transcribed manually. See remarks below for more details about Base32. |
| fileEncodeBase85 |
Use the Base85 algorithm, which encodes binary data
into a more compact form than Base64. Useful when file size
reduction is critical and full ASCII compatibility is required.
See remarks below for more details about Base85. |
| fileEncodeCompressed |
This option is used in combination with one of the encoding
types listed above. If specified, the file will be compressed
prior to being encoded by the control. This can significantly
reduce the size of the encoded output. |
Return Value
This method returns a value of zero if the file was successfully
encoded. A non-zero return value specifies an error code which
indicates the reason for the failure.
Remarks
The EncodeFile method encodes the contents of a file, using
the specified encoding method. When specifying the fileEncodeCompressed option, it is
important to remember that the compressed, encoded data can only be
restored to its original contents using the DecodeFile method.
This option should not be used when encoding a file to be attached to
an email message unless you provide the recipient with a utility to
decode the data.
If you wish to convert the contents of a text file to a different
Unicode encoding, use the ConvertFile method.
See Also
Encoding Property,
CompareFile Method,
CompressFile Method,
ConvertFile Method,
DecodeFile Method,
ExpandFile Method
|
|