Changeset 103 for trunk/UContact.pas
- Timestamp:
- Feb 9, 2022, 3:51:26 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UContact.pas
r98 r103 6 6 7 7 uses 8 Classes, SysUtils, fgl, Dialogs, UDataFile, LazUTF8, Base64 ;8 Classes, SysUtils, fgl, Dialogs, UDataFile, LazUTF8, Base64, Graphics; 9 9 10 10 type … … 195 195 VCardBegin = 'BEGIN:VCARD'; 196 196 VCardEnd = 'END:VCARD'; 197 VCardBase64 = 'BASE64'; 198 VCardQuotedPrintable = 'QUOTED-PRINTABLE'; 197 199 198 200 … … 571 573 I: Integer; 572 574 begin 573 if Attributes.IndexOf( 'BASE64') <> -1 then begin574 Encoding := 'BASE64';575 if Attributes.IndexOf(VCardBase64) <> -1 then begin 576 Encoding := VCardBase64; 575 577 Value := GetDecodedValue; 576 578 end else 577 579 if Attributes.IndexOfName('ENCODING') <> -1 then begin 578 580 Encoding := Attributes.Values['ENCODING']; 579 if (Encoding = 'B') or (Encoding = 'b') then Encoding := 'BASE64';580 if (Encoding = 'Q') or (Encoding = 'q') then Encoding := 'QUOTED-PRINTABLE';581 if (Encoding = 'QUOTED-PRINTABLE') or (Encoding = 'BASE64') then begin581 if (Encoding = 'B') or (Encoding = 'b') then Encoding := VCardBase64; 582 if (Encoding = 'Q') or (Encoding = 'q') then Encoding := VCardQuotedPrintable; 583 if (Encoding = VCardQuotedPrintable) or (Encoding = VCardBase64) then begin 582 584 Value := GetDecodedValue; 583 585 Attributes.Delete(Attributes.IndexOfName('ENCODING')); … … 600 602 function TContactProperty.GetDecodedValue: string; 601 603 begin 602 if Encoding = 'BASE64'then begin604 if Encoding = VCardBase64 then begin 603 605 Result := DecodeStringBase64(Value); 604 606 end else 605 if Encoding = 'QUOTED-PRINTABLE'then begin607 if Encoding = VCardQuotedPrintable then begin 606 608 Result := DecodeQuotedPrintable(Value, True); 607 609 end … … 611 613 function TContactProperty.GetEncodedValue: string; 612 614 begin 613 if Encoding = 'BASE64'then begin615 if Encoding = VCardBase64 then begin 614 616 Result := EncodeStringBase64(Value); 615 617 end else 616 if Encoding = 'QUOTED-PRINTABLE'then begin618 if Encoding = VCardQuotedPrintable then begin 617 619 Result := EncodeQuotedPrintable(Value, True); 618 620 end … … 1164 1166 if UTF8Length(OutText) > ContactsFile.MaxLineLength then begin 1165 1167 CutLength := ContactsFile.MaxLineLength; 1166 if Encoding = 'QUOTED-PRINTABLE'then begin1168 if Encoding = VCardQuotedPrintable then begin 1167 1169 Dec(CutLength); // There will be softline break at the end 1168 1170 // Do not cut encoded items at the end of line … … 1175 1177 CutText := UTF8Copy(OutText, 1, CutLength); 1176 1178 System.Delete(OutText, 1, Length(CutText)); 1177 if Encoding = 'QUOTED-PRINTABLE'then1179 if Encoding = VCardQuotedPrintable then 1178 1180 CutText := CutText + QuotedPrintableEscapeCharacter; // Add soft line break 1179 1181 Add(LinePrefix + CutText); 1180 if Encoding <> 'QUOTED-PRINTABLE'then1182 if Encoding <> VCardQuotedPrintable then 1181 1183 LinePrefix := ' '; 1182 1184 Inc(LineIndex);
Note:
See TracChangeset
for help on using the changeset viewer.