Why do I get a 'Invalid Character in a Base-64 String' error?