logo
Powered by QM on a Rpi server

KnowledgeBase 00068: Base 64 Encoding

Last updated: 22 Jul 2016
Applies to: All versions
Search  
Top level index       Full Index Search Tips
Previous article     Next article

This article was originally published as a Tip of the Week.

Base 64 encoding transforms a character string containing the full range of 8-bit characters into a string containing only a 64 character subset (upper and lower case letters, digits, the plus symbol and the forward slash). This encoded format is widely used to embed documents into web pages or in other cases where the data transmission protocol restricts the characters that can be sent.


The B64 Conversion Code

In QM, the B64 conversion code can be used with the OCONV() function to convert a character string into Base 64 format.

   ENCODED.STRING = OCONV(STRING, "B64") 
In common usage, the encoded data is divided into lines by insertion of newline characters, perhaps by use of the FOLD() function. Because the encoding process must always yield a string that is a multiple of four characters in length, there may be equals signs appended as padding.

The same conversion code used with the ICONV() function will convert a Base 64 encoded string back into an 8-bit string. Line breaks, padding characters and other invalid characters are ignored.


Related Articles

None.



Please tell us if this article was helpful
Very     Slightly     Not at all
Comments
Email (optional)