Search the web
Sign In
New User? Sign Up
tmail2000
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
the method "EncodeQuotedPrintable" is very slow?   Message List  
Reply | Forward Message #753 of 798 |
Re: the method "EncodeQuotedPrintable" is very slow?

Hi

Change EncodeQuotedPrintable function as bellow.

Joćo

function EncodeQuotedPrintable(const Texto: String; const HeaderLine:
Boolean): String;
var
nPos: Integer;
LineLen: Integer;
Buffer: TStringList;
j: Integer;
re, Line2: ^string;
b: Boolean;
begin

Result := '';
New( re );
New( line2 );

re^ := '';

j := Length( Texto );

for nPos := 1 to Length(Texto) do
begin

Form1.Gauge1.Progress := Trunc( ( 100 * nPos ) / j );

b := (Texto[nPos] > #127) or
(Texto[nPos] = '=') or
((Texto[nPos] < #32) and (not (Texto[nPos] in [#9, #10,
#13]))) or
((nPos < Length(Texto)) and (Texto[nPos] = #13) and (Texto
[nPos+1] <> #10)) or
((nPos = Length(Texto)) and (Texto[nPos] = #13)) or
((nPos > 1) and (Texto[nPos] = #10) and (Texto[nPos-1] <>
#13)) or
((nPos = 1) and (Texto[nPos] = #10)) or
((Texto[nPos] in [#9..#32,
#39, '?', '<', '>', '(', ')', '"', '_']) and HeaderLine);

case b of
True : begin
if Texto[ nPos ] = '=' then
re^ := re^ + '3D'
else
Re^ := Re^ + '=' + PadL( Format( '%2x', [ Ord(
Texto[ nPos ] ) ] ), 2, '0');
end;
else
Re^ := Re^ + Texto[nPos];
end;

// Encode trailing spaces/tabs

if not HeaderLine then
begin

if (Length(Re^ ) > 2)
and (Re^[Length(Re^)] = #10)
and (Re^[Length(Re^)-1] = #13)
and (Re^[Length(Re^)-2] in [#9, #32]) then
begin

LineLen := Length(Re^)-2;
Line2^ := '';

while (LineLen >= 1) and (Re^[LineLen] in [#9, #32]) do
begin

case Re^[LineLen] of
#09: Line2^ := '=09'+Line2^;
#32: Line2^ := '=20'+Line2^;
end;

Dec(LineLen);
if LineLen = 0 then Break;
end;

Re^ := Copy(Re^, 1, LineLen)+Line2^+#13#10;
end;
end;

Application.ProcessMessages;
end;

Dispose( Line2 );

// Insert soft linebreaks

if not HeaderLine then
begin

Buffer := TStringList.Create;
Buffer.Text := Re^;

nPos := 0;

while nPos < Buffer.Count do
begin

LineLen := Length(Buffer[nPos]);

while LineLen >= _LINELEN do
begin

if (LineLen >= 3)
and (Buffer[nPos][LineLen] in ['0'..'9', 'A'..'F'])
and (Buffer[nPos][LineLen-1] in ['0'..'9', 'A'..'F'])
and (Buffer[nPos][LineLen-2] = '=') then
Dec(LineLen, 3)
else
Dec(LineLen, 1);
Application.ProcessMessages;
end;

if LineLen < Length(Buffer[nPos]) then begin
Buffer.Insert(nPos+1, Copy(Buffer[nPos], LineLen+1, Length
(Buffer[nPos])));
Buffer[nPos] := Copy(Buffer[nPos], 1, LineLen)+'=';
end;

Inc(nPos);
Application.ProcessMessages;
end;

Re^ := Buffer.Text;
Result := Re^;
Dispose( re );
Application.ProcessMessages;
end;
end;








Thu May 12, 2005 7:33 pm

joaofcm00
Offline Offline
Send Email Send Email

Forward
Message #753 of 798 |
Expand Messages Author Sort by Date

hi, I am glad to get MailMessage2000, and I use it develop my email system.I very like this object. but now I have some trouble.I found In the source Code the...
vibowl
vibowlwan
Offline Send Email
Jan 21, 2005
10:07 am

Insert a few application.processmessages in the routine so the system responds during the encoding process. ... a ... give...
Keith Anderson
wildrailmoto...
Offline Send Email
Jan 31, 2005
10:04 am

Hi Change EncodeQuotedPrintable function as bellow. Joćo function EncodeQuotedPrintable(const Texto: String; const HeaderLine: Boolean): String; var nPos:...
joaofcm00
Offline Send Email
May 12, 2005
7:53 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help