Changeset 35 for trunk/UContact.pas


Ignore:
Timestamp:
Nov 25, 2021, 3:04:55 PM (3 years ago)
Author:
chronos
Message:
  • Added: Support for QUOTED-PRINTABLE encoding.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UContact.pas

    r34 r35  
    117117
    118118implementation
     119
     120uses
     121  UQuotedPrintable;
    119122
    120123resourcestring
     
    226229procedure TContactProperty.EvaluateAttributes;
    227230var
    228   Index: Integer;
     231  I: Integer;
    229232begin
    230233  if Attributes.IndexOf('BASE64') <> -1 then
    231234    Encoding := 'BASE64'
    232235  else
    233   if Attributes.IndexOfName('ENCODING') <> -1 then
    234     Encoding := Attributes.Values['ENCODING']
    235     else Encoding := '';
     236  if Attributes.IndexOfName('ENCODING') <> -1 then begin
     237    Encoding := Attributes.Values['ENCODING'];
     238    if (Encoding = 'QUOTED-PRINTABLE') or (Encoding = 'BASE64') then begin
     239      Values.DelimitedText := GetDecodedValue;
     240      Attributes.Delete(Attributes.IndexOfName('ENCODING'));
     241    end;
     242  end else Encoding := '';
    236243
    237244  if Attributes.IndexOfName('CHARSET') <> -1 then
     
    240247
    241248  // Simplify TYPE attribute from TYPE=VALUE into VALUE
    242   Index := Attributes.IndexOfName('TYPE');
    243   if Index <> -1 then
    244     Attributes.Strings[Index] := Attributes.Values['TYPE'];
     249  for I := 0 to Attributes.Count - 1 do begin
     250    if Attributes.Names[I] = 'TYPE' then
     251      Attributes.Strings[I] := Attributes.Values['TYPE'];
     252  end;
    245253end;
    246254
     
    251259  else
    252260  if Encoding = 'QUOTED-PRINTABLE' then
    253     Result := Values.DelimitedText
     261    Result := DecodeQuotedPrintable(Values.DelimitedText)
    254262  else Result := '';
    255263end;
Note: See TracChangeset for help on using the changeset viewer.