Base64 Encoding Errors

I am trying to base64 encode a string with non standard characters encoded in utf-8 also tried windows 1252  and I am getting error like so 


ERROR <Ens>ErrException: <ILLEGAL VALUE>zEncodeStream+18^ -- logged as '-' number - @' set encString = $TRANSLATE($SYSTEM.Encryption.Base64Encode(streamString),$C(10,13))' 

any help appreciated if anyone has faced this before



Base64 does not work with unicode with two or more bites. You should convert it first

write $system.Encryption.Base64Encode($zcvt("тест","O","UTF8"))