This function encodes a string in Base64. This is useful for securely transferring or storing data, especially binary data such as images or files that need to be converted to text form.