Re-2: UUencode - base64

Inge Bøhn inge at dakantus.no
Wed May 30 16:04:42 EDT 2012


Hi Lars and others.

To my surprise I have found by testing that  the UUencode command in  
Studio is not an UUencoder at all.
It is a complete base64 encoder.

This is confirmed by TL Technical Support in Hamburg.

I have found that it works both on encoding text and binary files.

Just in case some others are interested to know.

Regards
Inge

Den 29. mai. 2012 kl. 22.34 skrev Lars Schärer:

> Hi Inge,
>
> this one is for pRawString= char 10000000
> (and i'm afraid i does not support unicode.)
>
> i don't know if the code comes from kelly or if i started with some  
> javascript
>
> below you find another method for binary which i use for embeding  
> icons in html pages
> (converting Omnis Windows to html pages)
>
> Please tell us if you are successful with email attachments with  
> this code.
>
> Of course it will be much slower than an external - but for small  
> pictures it works well for me)
>
> LArs
>
> $EncodeBin2Base64(pBin)
>
> Calculate MyBase16 as "0123456789ABCDEF"
> Calculate MyOldBase as pwr(2,8)
>
> Calculate MyHexString as bintohex(pBin)
> Calculate MyHexStringLength as len(MyHexString)
> Calculate MyCounter as 1
> Enable cancel test at loops
> While MyCounter<=MyHexStringLength
> Calculate My2CHARHEX as mid(MyHexString,MyCounter,2)
> Calculate MyCounter as MyCounter+2
> Do method $int4hex2 (My2CHARHEX) Returns base256_1
>
> Calculate My2CHARHEX as mid(MyHexString,MyCounter,2)
> Calculate MyCounter as MyCounter+2
> Do method $int4hex2 (My2CHARHEX) Returns base256_2
>
> Calculate My2CHARHEX as mid(MyHexString,MyCounter,2)
> Calculate MyCounter as MyCounter+2
> Do method $int4hex2 (My2CHARHEX) Returns base256_3
>
> Calculate My3ByteNumber as (base256_1*MyOldBase+base256_2)*MyOldBase 
> +base256_3
> Calculate MyEmptyCHarCount as (MyCounter-1-MyHexStringLength)/2
>
> Do method $Encode3ByteNumBase64 (My3ByteNumber,MyEmptyCHarCount)  
> Returns My4CharBase64
> Calculate MyEncodedString as con(MyEncodedString,My4CharBase64)
> Working message  (Repeat count)
> End While
> Quit method MyEncodedString
>
>
> $int4hex2(p2CHARHEX=char len 2)
> Calculate MyBase16 as "0123456789ABCDEF"
> Calculate MyHexChar1 as left(p2CHARHEX,1)
> Calculate MyHExChar2 as right(p2CHARHEX,1)
> Calculate MyHexDigit1 as pos(MyHexChar1,MyBase16)-1
> Calculate MyHexDigit2 as pos(MyHExChar2,MyBase16)-1
> If MyHexDigit1=-1|MyHexDigit2=-1
> Calculate MyInt as -1
> Else
> Calculate MyInt as MyHexDigit1*16+MyHexDigit2
> End If
> Quit method MyInt
>
> $Encode3ByteNumBase64(p3ByteNumber=Number 0dp,pEmptyChars=short  
> number 0dp)
> Calculate MyBase64 as  
> "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
> Calculate MyNewBase as pwr(2,6)
> Calculate base64_4 as mod(p3ByteNumber,MyNewBase)+1
> Calculate p3ByteNumber as int(p3ByteNumber/MyNewBase)
> Calculate base64_3 as mod(p3ByteNumber,MyNewBase)+1
> Calculate p3ByteNumber as int(p3ByteNumber/MyNewBase)
> Calculate base64_2 as mod(p3ByteNumber,MyNewBase)+1
> Calculate p3ByteNumber as int(p3ByteNumber/MyNewBase)
> Calculate base64_1 as mod(p3ByteNumber,MyNewBase)+1
> ;  '=' is returned for nullbits
> If pEmptyChars=2
> Calculate base64_4 as 65
> Calculate base64_3 as 65
> Else If pEmptyChars=1
> Calculate base64_4 as 65
> End If
> ;  Set Omnis window title  
> {[con 
> (mid 
> (MyBase64 
> ,base64_1,1 
> ),mid 
> (MyBase64 
> ,base64_2,1),mid(MyBase64,base64_3,1),mid(MyBase64,base64_4,1))]}
> Calculate MyEncodedString as  
> con 
> (mid 
> (MyBase64 
> ,base64_1,1 
> ),mid 
> (MyBase64 
> ,base64_2,1),mid(MyBase64,base64_3,1),mid(MyBase64,base64_4,1))
> ;  End While
> Quit method MyEncodedString
>
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com




More information about the omnisdev-en mailing list