10

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\
WUgZW5jYW50YSB2ZXJsb3MgcHVlcyB1c3RlZGVzIHNlIHNhbGVuIGRlIGxhcyAgIHNpbXB\
sZXphcyB5IHN1cGVyZmljaWFsaWRhZGVzIGRlIGxvcyBub3RpY2llcm9zIHRyYWRpY2lvb\
mFsZXMuVW4gc2FsdWRvIGRlc2RlIE1vbnRyZWFsLSBDYW5hZGEuCgpBZGVsYW50ZSEgYXP\
DrSBjb21vIHZhbiBlbiBwb2NvIHRpZW1wbyB0ZW5kcsOhbiBtdWNob3MgbWFzIHNlZ3VpZ\
G9yZXMgcXVlICBsYSAiIkdyYW4gcHJlbnNhIENvbG9tYmlhbmEiIiBsYSBjdWFsIGhhIHZ\
lbmlkbyBtaW50aWVuZG8gcG9yIGTDqWNhZGFzLgoKIg=='

On Mathematica:

enter image description here

enter image description here

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

Alexey Popkov
  • 61,809
  • 7
  • 149
  • 368

1 Answers1

13

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"}]
Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263