Datetime 为什么在使用请求时解析my date成功,而在使用reqwests时解析my date失败?

Datetime 为什么在使用请求时解析my date成功,而在使用reqwests时解析my date失败?,datetime,encoding,rust,runtime-error,Datetime,Encoding,Rust,Runtime Error,我有一个包含以下日期的字符串2015-07-05T11:02:25+00:00 我使用以下代码来解析它(使用chrono板条箱) 当我使用请求板条箱获取内容时,日期被正确解析。 但是当我使用reqwests板条箱时,它会失败并显示错误消息 [2019-09-07 10:48:45.472951 +02:00] INFO [rrss2imap::feed] src\feed.rs:152: There should be new entries, parsing HTML content thre

我有一个包含以下日期的字符串
2015-07-05T11:02:25+00:00

我使用以下代码来解析它(使用chrono板条箱)

当我使用请求板条箱获取内容时,日期被正确解析。 但是当我使用reqwests板条箱时,它会失败并显示错误消息

[2019-09-07 10:48:45.472951 +02:00] INFO [rrss2imap::feed] src\feed.rs:152: There should be new entries, parsing HTML content
thread 'main' panicked at 'pub_date for item Item { title: Some("[Avis/BD] Capitaine Trèfle"), link: Some("https://fr.rec.arts.fantasy.narkive.com/Z2rKs6RJ/avis-bd-capitaine-trefle"), description: None, author: None, categories: [], comments: None, enclosure: None,
guid: None, pub_date: Some("2015-07-05T11:02:25+00:00"), source: None, content: None, extensions: {}, itunes_ext: None, dublin_core_ext: None } (value is "2015-07-05T11:02:25+00:00") can't be parsed. ParseError(Invalid)', src\feed.rs:236:17
如果我调试(使用VSCode Rust debugger),错误值只包含
无效(3'\x3')
。但我不明白它是从哪里来的。。。(我想这可能是某种编码问题,但它让我感到困惑,因为整个对象似乎完全正确)


我不明白出了什么问题。有人知道吗?

原来答案是一个简单的RFC2282不合规:源代码发送了
2015-07-05T11:02:25+00:00
。如RFC所述,时区信息在此格式中没有

不是有效的RFC2822时间,就这么简单。问题是
+00:00
不是此格式的有效时区描述符<代码>+0000应该是。@SébastienRenauld你应该把它设置为一个答案,因为它是正确的答案……我不确定它是否真的那么简单。写下答案:-)请注意,有一个板条箱()可以自动修复(以消耗的cpu时间为代价),可以自动修复rfc822日期时间。。。它解决了这个错误!
[2019-09-07 10:48:45.472951 +02:00] INFO [rrss2imap::feed] src\feed.rs:152: There should be new entries, parsing HTML content
thread 'main' panicked at 'pub_date for item Item { title: Some("[Avis/BD] Capitaine Trèfle"), link: Some("https://fr.rec.arts.fantasy.narkive.com/Z2rKs6RJ/avis-bd-capitaine-trefle"), description: None, author: None, categories: [], comments: None, enclosure: None,
guid: None, pub_date: Some("2015-07-05T11:02:25+00:00"), source: None, content: None, extensions: {}, itunes_ext: None, dublin_core_ext: None } (value is "2015-07-05T11:02:25+00:00") can't be parsed. ParseError(Invalid)', src\feed.rs:236:17