Skip to content

DFSEC_Encode

Include: Use System\Security.pkg

See Also: Encoding, DFSEC_Decode, DFSEC_EncodeUC

Purpose

Encodes a string or byte-compatible array and returns encoded text.

Syntax

Function DFSEC_Encode Global DFSEC_ENCODING_FORMAT eFormat Variant vValue Returns String

Arguments

eFormat : Encoding format. Use one of the C_DFSEC_ENCODING_* constants.

vValue : DataFlex string or byte-compatible array to encode.

Returns

Encoded text.

Behavior

DFSEC_Encode encodes vValue using eFormat and returns a String.

Empty input returns an empty string. An invalid format or unsupported value type raises DFERR_BAD_PARAMETER.

For URI encoding, output can match input when every byte is already URI-safe.

Example

String sUsername sPassword sCredentials sBasic

Move "bram" to sUsername
Move "secret" to sPassword
Move (sUsername + ":" + sPassword) to sCredentials
Get DFSEC_Encode C_DFSEC_ENCODING_BASE64 sCredentials to sBasic