Changeset 97 for trunk/UContact.pas
- Timestamp:
- Feb 4, 2022, 11:30:24 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UContact.pas
r93 r97 603 603 end else 604 604 if Encoding = 'QUOTED-PRINTABLE' then begin 605 Result := DecodeQuotedPrintable(Value );605 Result := DecodeQuotedPrintable(Value, True); 606 606 end 607 607 else Result := ''; … … 614 614 end else 615 615 if Encoding = 'QUOTED-PRINTABLE' then begin 616 Result := EncodeQuotedPrintable(Value );616 Result := EncodeQuotedPrintable(Value, True); 617 617 end 618 618 else Result := ''; … … 1164 1164 CutLength := ContactsFile.MaxLineLength; 1165 1165 if Encoding = 'QUOTED-PRINTABLE' then begin 1166 // Do not cut encoded items 1167 if ((CutLength - 2) >= 1) and (OutText[CutLength - 2] = '=') then 1166 Dec(CutLength); // There will be softline break at the end 1167 // Do not cut encoded items at the end of line 1168 if ((CutLength - 1) >= 1) and (OutText[CutLength - 1] = QuotedPrintableEscapeCharacter) then 1168 1169 Dec(CutLength, 2) 1169 else if ((CutLength - 1) >= 1) and (OutText[CutLength - 1] = '=')then1170 else if OutText[CutLength] = QuotedPrintableEscapeCharacter then 1170 1171 Dec(CutLength, 1); 1171 1172 end; 1173 1172 1174 CutText := UTF8Copy(OutText, 1, CutLength); 1175 System.Delete(OutText, 1, Length(CutText)); 1176 if Encoding = 'QUOTED-PRINTABLE' then 1177 CutText := CutText + QuotedPrintableEscapeCharacter; // Add soft line break 1173 1178 Add(LinePrefix + CutText); 1174 LinePrefix := ' ';1175 System.Delete(OutText, 1, Length(CutText));1179 if Encoding <> 'QUOTED-PRINTABLE' then 1180 LinePrefix := ' '; 1176 1181 Inc(LineIndex); 1177 1182 Continue; … … 1199 1204 CommandPart: string; 1200 1205 Names: string; 1206 QuotedPrintableMultiLine: Boolean; 1201 1207 begin 1202 1208 Result := False; … … 1228 1234 CommandPart := GetNext(Line, ':'); 1229 1235 Names := CommandPart; 1236 QuotedPrintableMultiLine := Pos('encoding=quoted-printable', LowerCase(CommandPart)) > 0; 1230 1237 Value := Line; 1231 1238 while True do begin … … 1237 1244 Value := Value + Copy(Line2, 2, MaxInt); 1238 1245 end else 1239 if (Length(Line2) > 0) and (Length(Value) > 0) and (Value[Length(Value)] = '=') and 1240 (Line2[1] = '=') then begin 1241 Value := Value + Copy(Line2, 2, MaxInt); 1246 if QuotedPrintableMultiLine and (Length(Value) > 0) and 1247 (Value[Length(Value)] = QuotedPrintableEscapeCharacter) then begin 1248 SetLength(Value, Length(Value) - 1); 1249 Value := Value + Line2; 1242 1250 end else begin 1243 1251 Dec(I);
Note:
See TracChangeset
for help on using the changeset viewer.