diff --git a/harbour/ChangeLog b/harbour/ChangeLog index caa40333bf..ab37eae814 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,21 @@ The license applies to all entries newer than 2009-04-28. */ +2012-05-04 03:18 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/hbct/getsecrt.prg + * use hb_keyCode() instead of Asc() to form numeric key value. + + * contrib/hbtip/encqp.prg + ! Quoted-printable encoding/decoding fixed to use FOR/NEXT + loop instead of FOR/EACH and HB_B*() string functions to + operate on binary data regardless of HVM CP. + ! Fixed old typo causing no encoding for line-ending whitespaces. + + * contrib/hbtip/mail.prg + ! Q-encoding fixed to use FOR/NEXT + loop instead of FOR/EACH and HB_B*() string functions to + operate on binary data regardless of HVM CP + 2012-05-04 01:51 UTC+0200 Viktor Szakats (harbour syenar.net) * include/harbour.hbx * src/rtl/cdpapihb.c diff --git a/harbour/contrib/hbct/getsecrt.prg b/harbour/contrib/hbct/getsecrt.prg index 55359cb6a6..066e6d4a61 100644 --- a/harbour/contrib/hbct/getsecrt.prg +++ b/harbour/contrib/hbct/getsecrt.prg @@ -140,7 +140,7 @@ STATIC PROCEDURE _SECRET( _cGetSecret, lHide, oGet, oGetList ) ELSE _cGetSecret := STUFF( _cGetSecret, oGet:pos, 1, cKey ) ENDIF - nKey := ASC( "*" ) + nKey := hb_keyCode( "*" ) ENDIF GetApplyKey( oGet, nKey ) ENDDO diff --git a/harbour/contrib/hbtip/encqp.prg b/harbour/contrib/hbtip/encqp.prg index b055075c1b..8afa517ed6 100644 --- a/harbour/contrib/hbtip/encqp.prg +++ b/harbour/contrib/hbtip/encqp.prg @@ -63,18 +63,22 @@ METHOD New() CLASS TIPEncoderQP RETURN Self METHOD Encode( cData ) CLASS TIPEncoderQP + LOCAL nPos LOCAL c + LOCAL nLen LOCAL cString := "" LOCAL nLineLen := 0 - FOR EACH c IN cData + nLen := hb_BLen( cData ) + FOR nPos := 1 TO nLen + c := hb_BSubStr( cData, nPos, 1 ) IF c == Chr( 13 ) cString += Chr( 13 ) + Chr( 10 ) nLineLen := 0 ELSEIF Asc( c ) > 126 .OR. ; c $ '=?!"#$@[\]^`{|}~' .OR. ; ( Asc( c ) < 32 .AND. !( c $ Chr( 13 ) + Chr( 10 ) + Chr( 9 ) ) ) .OR. ; - ( c $ " " + Chr( 9 ) .AND. SubStr( cData, c:__enumIndex() + 1 ) $ Chr( 13 ) + Chr( 10 ) ) + ( c $ " " + Chr( 9 ) .AND. hb_BSubStr( cData, nPos + 1, 1 ) $ Chr( 13 ) + Chr( 10 ) ) IF nLineLen + 3 > 76 cString += "=" + Chr( 13 ) + Chr( 10 ) nLineLen := 0 @@ -99,11 +103,11 @@ METHOD Decode( cData ) CLASS TIPEncoderQP cData := StrTran( cData, "=" + Chr( 13 ) + Chr( 10 ) ) cData := StrTran( cData, "=" + Chr( 10 ) ) /* also delete non-standard line breaks */ - nLen := Len( cData ) + nLen := hb_BLen( cData ) FOR tmp := 1 TO nLen - c := SubStr( cData, tmp, 1 ) - IF c == "=" .AND. Len( SubStr( cData, tmp + 1, 2 ) ) == 2 - cString += Chr( hb_HexToNum( SubStr( cData, tmp + 1, 2 ) ) ) + c := hb_BSubStr( cData, tmp, 1 ) + IF c == "=" .AND. hb_BLen( hb_BSubStr( cData, tmp + 1, 2 ) ) == 2 + cString += Chr( hb_HexToNum( hb_BSubStr( cData, tmp + 1, 2 ) ) ) tmp += 2 ELSE cString += c diff --git a/harbour/contrib/hbtip/mail.prg b/harbour/contrib/hbtip/mail.prg index a94e4b86df..31760711fb 100644 --- a/harbour/contrib/hbtip/mail.prg +++ b/harbour/contrib/hbtip/mail.prg @@ -682,6 +682,7 @@ METHOD getMultiParts( aParts ) CLASS TipMail RETURN aParts STATIC FUNCTION WordEncodeQ( cData, cCharset ) + LOCAL nPos LOCAL c LOCAL cString LOCAL nLineLen := 0 @@ -695,7 +696,8 @@ STATIC FUNCTION WordEncodeQ( cData, cCharset ) cString := "=?" + cCharset + "?" + "Q" + "?" - FOR EACH c IN cData + FOR nPos := 1 TO hb_BLen( cData ) + c := hb_BSubStr( cData, nPos, 1 ) IF Asc( c ) > 126 .OR. ; c $ '=?!"#$@[\]^`{|}~_' .OR. ; Asc( c ) <= 32