【发布时间】:2015-05-17 06:33:18
【问题描述】:
看来IndyGMTToLocalDateTime在解码日期的时候并没有忽略cmets:
TDateTime dtDate1 = GMTToLocalDateTime("12 Mar 2015 14:03:21 -0000");
TDateTime dtDate2 = GMTToLocalDateTime("Thu, 12 Mar 2015 14:03:20 +0000 (GMT)");
TDateTime dtDate3 = GMTToLocalDateTime("Thu, 12 Mar 2015 14:03:20 +0000 (envelope-from <aaa@bbb.ccc>)");
TDateTime dtDate4 = GMTToLocalDateTime("Thu, 12 Mar 2015 14:03:20 +0000 (aaa@bbb.ccc)");
UnicodeString Dt1 = DateTimeToStr(dtDate1);
UnicodeString Dt2 = DateTimeToStr(dtDate2);
UnicodeString Dt3 = DateTimeToStr(dtDate3);
UnicodeString Dt4 = DateTimeToStr(dtDate4);
前 2 个已正确解码。最后2个不是。 括号中的部分应该被忽略,因为它只是一个注释,但似乎不是。
这是 Indy 中的错误吗? 另外 - 是否有针对 Indy 的错误跟踪器(因为论坛似乎已关闭)?
【问题讨论】:
-
您从哪里得到这些括号内的内容可能是被忽略的评论的信息? (这让我想起了
this announcement:) -
在电子邮件标头中允许嵌入 cmets(请参阅 RFC 822 第 3.4.3 节),但在处理标头数据时应该被忽略。所以在这种情况下,调用者有责任在将数据传递给
GMTToLocalDateTime()之前剥离cmets。
标签: delphi datetime c++builder indy