Sample code for 30+ languages & platforms
PowerBuilder

UU Encoding and Decoding

See more Encryption Examples

Demonstrates how to UU encode and decode.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Crypt
string ls_S1
string ls_S2
string ls_S3
oleobject loo_Crypt2

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Crypt = create oleobject
li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2")
if li_rc < 0 then
    destroy loo_Crypt
    MessageBox("Error","Connecting to COM object failed")
    return
end if

ls_S1 = "This string is to be UU encoded"

loo_Crypt.UuMode = "666"
loo_Crypt.UuFilename = "something.txt"

// UU encode:
ls_S2 = loo_Crypt.EncodeString(ls_S1,"ansi","uu")

// Note: Call crypt.Encode instead of crypt.EncodeString
// to UU encode binary bytes (i.e. non-text binary data).

Write-Debug ls_S2

// UU decode:
loo_Crypt2 = create oleobject
li_rc = loo_Crypt2.ConnectToNewObject("Chilkat.Crypt2")

ls_S3 = loo_Crypt2.DecodeString(ls_S2,"ansi","uu")

// Note: Likewise, call crypt.Decode to decode non-text binary data.

Write-Debug ls_S3

// Show the file permissions mode and filename found
// in the UU encoded data:
Write-Debug "UuMode = " + loo_Crypt2.UuMode
Write-Debug "UuFilename = " + loo_Crypt2.UuFilename


destroy loo_Crypt
destroy loo_Crypt2