How to reproduce Wolfram Language’s base64 encoded string with command-line tool?


With Wolfram Language:

In[7]:= ExportString["foobar中文", "Base64"]  Out[7]= "Zm9vYmFyXDo0ZTJkXDo2NTg3" 

With the closest command-line software I could think of

echo -n 'foobar中文' | openssl base64                                                                        Zm9vYmFy5Lit5paH 

Why the difference? What’s the best way to reproduce Mathematica’s behavior?