Fix base64 due to from_utf8 and replace changes

These two changes were made in rust's std lib:
    1. `str::replace` was a method of str, now it's a function.
    2. `from_utf8` now wraps its return value in Option.