Sample code for 30+ languages & platforms
DataFlex

Base64 Encode/Decode a String

See more Encryption Examples

_LANGUAGE_ example to base-64 encode and decode a string.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoBd
    String s
    String sStrBase64
2    Handle hoBd2
    String sDecoded

    Move False To iSuccess

    Get Create (RefClass(cComChilkatBinData)) To hoBd
    If (Not(IsComObjectCreated(hoBd))) Begin
        Send CreateComObject of hoBd
    End

    Move "A friend called me up the other day and talked about investing in a dot-com that sells lobsters. Internet lobsters. Where will this end? --Donald Trump" To s

    Get ComAppendString Of hoBd s "utf-8" To iSuccess

    Get ComGetEncoded Of hoBd "base64" To sStrBase64
    Showln sStrBase64

    // To decode:
    Get Create (RefClass(cComChilkatBinData)) To hoBd2
    If (Not(IsComObjectCreated(hoBd2))) Begin
        Send CreateComObject of hoBd2
    End
    Get ComAppendEncoded Of hoBd2 sStrBase64 "base64" To iSuccess

    Get ComGetString Of hoBd2 "utf-8" To sDecoded
    Showln sDecoded


End_Procedure