Fix MIME bug #26 (Pierre le Riche)

git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@222 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
geby 2021-06-12 16:29:06 +00:00
parent 22e0067948
commit 039fa1c3b5
3 changed files with 38 additions and 9 deletions

View File

@ -640,7 +640,7 @@ begin
Secondary := 'plain'; Secondary := 'plain';
Description := 'Message text'; Description := 'Message text';
Disposition := 'inline'; Disposition := 'inline';
CharsetCode := IdealCharsetCoding(Value.Text, TargetCharset, IdealCharsets); CharsetCode := IdealCharsetCoding(AnsiString(Value.Text), TargetCharset, IdealCharsets);
EncodingCode := ME_QUOTED_PRINTABLE; EncodingCode := ME_QUOTED_PRINTABLE;
EncodePart; EncodePart;
EncodePartHeader; EncodePartHeader;

View File

@ -966,7 +966,11 @@ end;
procedure TMIMEPart.EncodePart; procedure TMIMEPart.EncodePart;
var var
l: TStringList; l: TStringList;
s, t: string; {$IFDEF UNICODE}
s, t: RawByteString;
{$ELSE}
s, t: string;
{$ENDIF}
n, x: Integer; n, x: Integer;
d1, d2: integer; d1, d2: integer;
begin begin
@ -1076,7 +1080,7 @@ begin
FHeaders.Insert(0, 'Content-Disposition: ' + LowerCase(FDisposition) + s); FHeaders.Insert(0, 'Content-Disposition: ' + LowerCase(FDisposition) + s);
end; end;
if FContentID <> '' then if FContentID <> '' then
FHeaders.Insert(0, 'Content-ID: ' + FContentID); FHeaders.Insert(0, 'Content-ID: <' + FContentID + '>');
case FEncodingCode of case FEncodingCode of
ME_7BIT: ME_7BIT:

View File

@ -1,5 +1,5 @@
{==============================================================================| {==============================================================================|
| Project : Ararat Synapse | 005.002.004 | | Project : Ararat Synapse | 005.002.005 |
|==============================================================================| |==============================================================================|
| Content: Charset conversion support | | Content: Charset conversion support |
|==============================================================================| |==============================================================================|
@ -1744,15 +1744,40 @@ begin
Result := ''; Result := '';
case Value of case Value of
UCS_2: UCS_2:
Result := #$fe + #$ff; begin
SetLength(Result, 2);
Result[1] := #$fe;
Result[2] := #$ff;
end;
UCS_4: UCS_4:
Result := #$00 + #$00 + #$fe + #$ff; begin
SetLength(Result, 4);
Result[1] := #$00;
Result[2] := #$00;
Result[3] := #$fe;
Result[4] := #$ff;
end;
UCS_2LE: UCS_2LE:
Result := #$ff + #$fe; begin
SetLength(Result, 2);
Result[1] := #$ff;
Result[2] := #$fe;
end;
UCS_4LE: UCS_4LE:
Result := #$ff + #$fe + #$00 + #$00; begin
SetLength(Result, 4);
Result[1] := #$ff;
Result[2] := #$fe;
Result[3] := #$00;
Result[4] := #$00;
end;
UTF_8: UTF_8:
Result := #$ef + #$bb + #$bf; begin
SetLength(Result, 3);
Result[1] := #$ef;
Result[2] := #$bb;
Result[3] := #$bf;
end;
end; end;
end; end;