Function DoURLEncodeString Global String sSource Returns String
    String sEnc
    Integer hoCrypt

    Indicate err False
    Get Create U_cComChilkatCrypt2 to hoCrypt
    Send CreateComObject to hoCrypt
    If (err) Function_Return ""

    Get ComUnlockComponent of hoCrypt "..." to windowindex

    Set ComCharset of hoCrypt to "us-ascii"
    Set ComCryptAlgorithm of hoCrypt to "none"
    Set ComEncodingMode of hoCrypt to "url"

    Get ComEncryptStringENC of hoCrypt (trim(sSource)) to sEnc

    Send Destroy to hoCrypt

    Function_Return sEnc
End_Function