This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
BASE64 DECODE

BASE64 DECODE 


 

BASE64 DECODE ( toDecode {; decoded}{; *} ) 
Parameter Type   Description
toDecode  Text, BLOB in Encoded value to decode
in Decoded value (if decoded parameter omitted)
decoded  Text, BLOB in Decoded value
Operator in Decode in Base64URL format

The BASE64 DECODE command decodes the text or blob value coded in Base64 or Base64URL format passed in the toDecode parameter. For more information on Base64 and Base64URL formats, please refer to the BASE64 ENCODE command description. 

Pass in toDecode the Base64 or Base64URL encoded text or blob value to decode. 

If you pass the decoded parameter, the command decodes the contents of toDecode in the decoded parameter -- the toDecode parameter is left untouched. If you omit the decoded parameter, the command directly modifies the contents of the toDecode parameter.

Note: If a text variable is passed to receive what is decoded by the command, it receives the decoded bytes interpreted as utf-8.

By default if the * parameter is omitted, the command uses a Base64 decoding. If you pass the * parameter, the command uses a Base64URL decoding.

If toDecode contains an invalid base64 contents, an empty text or blob value is returned. 

Example  

This example lets you transfer a picture via a BLOB:

 C_BLOB($sourceBlob)
 C_PICTURE($mypicture)
 $mypicture:=[people]photo
 PICTURE TO BLOB($mypicture;$sourceBlob;".JPG")
 C_TEXT($base64Text)
 BASE64 ENCODE($sourceBlob;$base64Text//Encoding of text
  // the binary is now available as character strings in $base64Text
 
 C_TEXT($base64Text)
 C_BLOB($targetBlob)
 BASE64 DECODE($base64Text;$targetBlob//Decoding of text
  // the binary encoded in base 64 is now available as a BLOB in $blobTarget



See also 

BASE64 ENCODE
Generate digest
Overview of XML DOM Commands
XML DECODE

 
PROPERTIES 

Product: 4D
Theme: Tools
Number: 896

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D 2004
Renamed: 4D v12 (DECODE)
Modified: 4D v12
Modified: 4D v18 R4

 
ARTICLE USAGE

4D Language Reference ( 4D v20 R7)