Problem with Base64

Hi all,

Im reading XML file which has Content tag which has binary data(i
assume). I need to read that content and store it as image.

Content Data in XML looks like this:
WEcxA1HTcsbiHgufPW41U1Du0HAdIY/WvTSB1s9NGtgW4W4BMSHJnnjF/m4K+vKuF0d8Q29yLWNzlvmT9orboet9EYouFMX9QvG3sV0PO7/gtXF7BjQGhGoSzh+Pg8iWk705TkOSm/5LrKOsqx5JrCNh4eqHTyuWBhV6PGDV+AUack69Diqei+DJUn2ze+5otVoSs2mgpiV4Wmp9Djc0rYXrrqDpmcxjIfo61uK3JpvaFBConokCgR1JKNS6BgMIDg==

XML Tag is :
WEcxA1HTcsbiHgufPW41U1Du0HAdIY/WvTSB1s9NGtgW4W4BMSHJnnjF/m4K+vKuF0d8Q29yLWNzlvmT9orboet9EYouFMX9QvG3sV0PO7/gtXF7BjQGhGoSzh+Pg8iWk705TkOSm/5LrKOsqx5JrCNh4eqHTyuWBhV6PGDV+AUack69Diqei+DJUn2ze+5otVoSs2mgpiV4Wmp9Djc0rYXrrqDpmcxjIfo61uK3JpvaFBConokCgR1JKNS6BgMIDg==

Please find the attach sample xml data. Code written so far is as
follows,

require ‘base64’
@content =
‘WEcxAyEJQTXiHgufhAdVefCCvSH2njBUZ/dzBOsTuNj9guPeaJrJL80KjGWl8dglgJ56veLnyl/Fdu8I1tS7uAR65G82/WxygyR/lOE7bNLMCHS1p3Ah48iCzQBSJ1jnOl1HuL8hAR0aGhHIN8oW7IofdVX0YPSaQoanrUkz7iPt56TbZH5qiynHqLD9ZepkDGpSAUuInzLZG/2BixmyuqH2ctZnMqPAJR4vveB7mT7KVsJRIofMZqK6ptHWRAmk4w==’
@filename= ‘Sana.jpg’

File.open(@filename, ‘wb’) do|f|

f.write(Base64.decode64(@content))
end

Please help im new to Ruby

-----Messaggio originale-----
Da: Sagar V. [mailto:[email protected]]
Inviato: gioved 29 dicembre 2011 09:09
A: ruby-talk ML
Oggetto: Problem with Base64


Caselle da 1GB, trasmetti allegati fino a 3GB e in piu’ IMAP, POP3 e
SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f

Sponsor:
Riccione Hotel 3 stelle in centro: Pacchetto Capodanno mezza pensione,
animazione bimbi, zona relax, parcheggio. Scopri l’offerta solo per
oggi…
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid983&d)-12