remove trail newline chars from encodeBase64() result
add sample tests