base64: don't rely on feof returning 0/1