Hmm... I don't know what's going on but there's something funky going on. Make a new text file named Base64Test.txt with content:
Code: Select all
Hello!
こんにちは!
您好!
مرحبا!
Здравствуйте!
Using Marco's code:
Code: Select all
"ENCODE"
$Path = <curitem>;
$File = ReadFile($Path, "b");
$Encoding = Base64Encode($File, 1);
$Encoding = Formatlist($Encoding, "p", <crlf>, 76) . <crlf>;
WriteFile($Path . ".Base64.txt", $Encoding, , "ta");
"DECODE"
$Path = <curitem>;
$Encoding = ReadFile($Path, "t");
$Encoding = Regexreplace($Encoding, <crlf>);
$File = Base64Decode($Encoding, 1);
$Path = RegexReplace($Path, "\.Base64\.txt$");
WriteFile($Path, $File, , "b");
Encode the file and then decode the file. The result is all gibberish for anything not using plain Roman letters. I tested the base64encoding and base64decoding using something like:
Code: Select all
Text Base64Decode(Base64Encode("Здравствуйте!", 1), 1);
and it works perfectly. So I'm guessing there's something else wrong with the readfile in binary format? I tried encoding and then decoding other files like pictures too and they all ended up corrupted.