[Gambas-user] Base 64 question

Fabien Bodard gambas.fr at ...626...
Thu Apr 28 13:38:52 CEST 2011


Print XmlReader.Decode("strvalue", "Base64")

2011/4/28 richard terry <rterry at ...1946...>:
> On Thursday 28 April 2011 20:16:31 Fabien Bodard wrote:
> I tried  this:
>  XmlReader.Decode(data, "?????"
>
> what goes in the encoding type "?????"
>
> I looked on the website to no avail
> I tried strings like "Base64", "base64" etc
>
> couldn't figure it out.
>
> any hlep appreciated.
>
> Richard
>
>
>> gb.xml !
>>
>> 2011/4/28 Caveat <Gambas at ...1950...>:
>> > Hi Richard,
>> >
>> > I don't know of any base64 decode function in Gambas, but then I didn't
>> > look that hard ;-)
>> >
>> > There are various different flavours of base64, so be sure you know
>> > which variant you're dealing with.
>> >
>> > I enclose with this mail a source archive of a little project I've put
>> > together (sorry, it's Gambas2, hope that's OK) that demonstrates
>> > decoding (and encoding) of base64 data.  I found the information on how
>> > to put together the encode and decode algorithms here:
>> > http://en.wikipedia.org/wiki/Base64
>> >
>> > There's also a reference to base64 in Gambas here:
>> > http://www.gambasforum.com/index.php?topic=330.0
>> > The algorithms given in those code snippets could well be far more
>> > efficient than mine.
>> >
>> > My Base64 Project
>> > -----------------
>> > First thing to try is just hit the Encode button, it should convert the
>> > text in the top textarea into base64 and place the result in the lower
>> > textarea. Generally, if the In textbox is blank, the input for Encode or
>> > Decode will be the upper textarea, and if the Out textbox is blank, the
>> > output of the Encode or Decode will be shown in the lower textarea.  To
>> > encode binary data, you'll need to use a file as input, so use the In
>> > textbox to specify the file name.  To decode base64 that represents
>> > binary data, you'll need to use a file as output, so use the Out textbox
>> > to specify the output file name.
>> >
>> > You can try out binary to base64 using fluffy.jpg (shipped with the
>> > project) as your In file.
>> >
>> > To test round-trip (so start with a binary, encode it to base64, then
>> > decode the base64 data to make an identical binary)... enter fluffy.jpg
>> > in the In textbox, blank the Out textbox, hit Encode.  In the lower
>> > textarea Select All, Copy... then in the upper textarea Paste.  Now
>> > clear the In textbox and enter coffee.jpg in the Out textbox.  Hit
>> > Decode.  You *should* find a new file in your Base64 project directory
>> > called coffee.jpg, and it *should* be identical to the fluffy.jpg
>> > shipped with the project.
>> >
>> > I'm not convinced that my completely untuned, horribly inefficient
>> > algorithms in Gambas will be the best way to go if speed is of the
>> > essence or if the pdf files are gonna be more than a few 100 kbs... you
>> > might find it quicker/more robust to call out to a built-in function in
>> > java/python/some other program...
>> >
>> > Anyways, all the (commented) source is there for you to see/fiddle
>> > with...so have fun, but if you have any questions, just give me a shout.
>> >
>> > Regards,
>> > Caveat
>> >
>> > On Thu, 2011-04-28 at 07:38 +1000, Ian Haywood wrote:
>> >> No, HL7 parsing is fine, let me restate the question: does gambas have
>> >> an inbuilt function to
>> >> decode base 64 data?
>> >>
>> >> Ian
>> >>
>> >> On Thu, Apr 28, 2011 at 3:48 AM, nando <nando_f at ...951...> wrote:
>> >> > Health Level 7 file format
>> >> > To start visit:
>> >> > http://en.wikipedia.org/wiki/Health_Level_7
>> >> >
>> >> >
>> >> > ---------- Original Message -----------
>> >> > From: richard terry <rterry at ...1946...>
>> >> > To: mailing list for gambas users <gambas-user at ...625...t>
>> >> > Sent: Wed, 27 Apr 2011 18:13:57 +1000
>> >> > Subject: [Gambas-user] Base 64 question
>> >> >
>> >> >> Hi list,
>> >> >>
>> >> >> I've a HL7 file apparently with embedded base64 data (as a pdf) I
>> >> >> wondered if there iwas any way to de-encode the data, if that is the
>> >> >> right syntax.
>> >> >>
>> >> >> Regards
>> >> >>
>> >> >> Richard
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >>--------- WhatsUp Gold - Download Free Network Management Software
>> >> >> The most intuitive, comprehensive, and cost-effective network
>> >> >> management toolset available today.  Delivers lowest initial
>> >> >> acquisition cost and overall TCO of any competing solution.
>> >> >> http://p.sf.net/sfu/whatsupgold-sd
>> >> >> _______________________________________________
>> >> >> Gambas-user mailing list
>> >> >> Gambas-user at lists.sourceforge.net
>> >> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
>> >> >
>> >> > ------- End of Original Message -------
>> >> >
>> >> >
>> >> > ----------------------------------------------------------------------
>> >> >-------- WhatsUp Gold - Download Free Network Management Software
>> >> > The most intuitive, comprehensive, and cost-effective network
>> >> > management toolset available today.  Delivers lowest initial
>> >> > acquisition cost and overall TCO of any competing solution.
>> >> > http://p.sf.net/sfu/whatsupgold-sd
>> >> > _______________________________________________
>> >> > Gambas-user mailing list
>> >> > Gambas-user at lists.sourceforge.net
>> >> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>> >>
>> >> ------------------------------------------------------------------------
>> >>------ WhatsUp Gold - Download Free Network Management Software
>> >> The most intuitive, comprehensive, and cost-effective network
>> >> management toolset available today.  Delivers lowest initial
>> >> acquisition cost and overall TCO of any competing solution.
>> >> http://p.sf.net/sfu/whatsupgold-sd
>> >> _______________________________________________
>> >> Gambas-user mailing list
>> >> Gambas-user at lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
>> >
>> > -------------------------------------------------------------------------
>> >----- WhatsUp Gold - Download Free Network Management Software
>> > The most intuitive, comprehensive, and cost-effective network
>> > management toolset available today.  Delivers lowest initial
>> > acquisition cost and overall TCO of any competing solution.
>> > http://p.sf.net/sfu/whatsupgold-sd
>> > _______________________________________________
>> > Gambas-user mailing list
>> > Gambas-user at lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today.  Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 
Fabien Bodard




More information about the User mailing list