anyone here got a function to find is a string is base64 encoded?

Andre Garzia soapdog at mac.com
Sun Jul 25 17:05:30 EDT 2004


Wouter and All,

thank you very much for all your replies! Noew thanks to this function, 
we can probe a string to see if it is Base64 encoded and add it as a 
<base64> item in the XML-RPC Lib!

Thanks
andre


On Jul 25, 2004, at 5:19 PM, Wouter wrote:

> --snip
>
> Oops typo
>
>> One could  test for a *welformed* base64Encodeded string :
>>
>> function isWelformed64 pText
>>   replace cr with "" in pText
>>   if the num of chars in tText mod 4 = 0 then
>>      repeat for each char i in pText
>>       put i into tArray[i]
>>     end repeat
>
>     put the keys of tArray into tKeys
>
>>     if "=" is in tKeys then
>>       put the num of chars in pText - 1 into x
>>       put 1 into tC
>>       repeat for each char i in pText
>>         if  i = "=" and tC < x then return false
>>         add 1 to tC
>>       end repeat
>>     end if
>>     repeat for each line i in tKeys
>>       if i is not in "abcdefghijklmnopqrstuvwxyz1234567890/=" then 
>> return false
>>     end repeat
>>     return true
>>   else return false
>> end isWelformed64
>>
>>
>
> Sorry,
> Greetings,
> WA
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
-- 
Andre Alves Garzia ð 2004
Soap Dog Studios - BRAZIL
http://studio.soapdog.org



More information about the use-livecode mailing list