Yes, you can and like Jeff indicates you need to require the base64 package.
I do the following (using Jeff’s example):
set msg_data_encoded [base64::encode $str]
set xlateOutVals [lreplace $xlateOutVals 0 0 $msg_data_encoded]
BUT – if you are encoding the data in sructured message (HL/7, X12, etc.), what if encoding characters (HL/7 ‘| ^ ~, etc’) are in the data to be encoded? It is possible the inbound may not parse out correctly.
Jim
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.