Replace the script with my version!
Delphi XE editions have a bug with String and ANSI/UTF8 Mode switching.
String has dual definition. ANSI and UTF8
Form Element Memo is designed UTF8. So Encryption and Decryption works without problem.
At the script you can see that it will work if you do encryption at the Memo Field and transfer encrypted content to String. String get the internal information to switch to UTF8 Mode.
Base64 not tested, but if you search for "UTF8 to Base64 Delphi Source Code" you get various information for a converting problem with Delphi XE editions with UTF8 and Base64. For correct converting you need a few lines more code to convert String to Widestring and telling the internal Base64 function to switch to UTF8 Mode instead of ANSI Mode.
Or you try to find a complete source code.
Use online converter for testing.
For converting String variables you need to bring String fixed to UTF8 Mode or you convert it direcly to Base64. This would result the following structure:
EncryptRC5(Content : String, Key : String) : Base64
DecryptRC5(Content : Base64, Key : String) : String (or WideString)
You can see the switching problem on the text4 variable: The length is double as from the text1 variable. UTF8 has two bytes, ANSI one byte. String is not correclty catching the mode switching. And this results also in the problem, that the Database does not get the right information what to store. ANSI or UTF.
Delphi 10 editions have a better switching selection for String.
Expensive - maybe Lazarus would be interesting and cheaper to look into....
Post's attachments script.pas 6.2 kb, 622 downloads since 2017-10-26