I'm handling some paragraphs encoded with Base64 from CSV file format. The problem is that Mathematica can't decode it. I'm thinking to write my decode method by my own, but I ask it first.

By example:

I used base64.b64encode on python with the string:

s = '"Hola los felicito por su equipo de comunicadores. Me encanta verlos pues ustedes se salen de las   simplezas y superficialidades de los noticieros tradicionales.Un saludo desde Montreal- Canada.

Adelante! así como van en poco tiempo tendrán muchos mas seguidores que  la ""Gran prensa Colombiana"" la cual ha venido mintiendo por décadas.


And outcome:

 b = 'IkhvbGEgbG9zIGZlbGljaXRvIHBvciBzdSBlcXVpcG8gZGUgY29tdW5pY2Fkb3Jlcy4gT\

On Mathematica:

enter image description here

enter image description here

But if you use another base64 decoder like decoderb64, it can do the job.


That's because "Base64" is not a format but an encoding and you still need to tell Mathematica what format to import after decoding from Base64. This is described in the documentation.

Try this:

ImportString[s, {"Base64", "String"}]
  • $\begingroup$ Oh, Thanks, I don't figure out. I thought that "String" was implicit. $\endgroup$ – jonaprieto Apr 3 '14 at 14:45
  • 1
    $\begingroup$ @d555 It could be anything, not just String. Base64 is considered an encoding just like gzip (which is also supported). Any file in any format can be encoded like this. $\endgroup$ – Szabolcs Apr 3 '14 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.