1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
diff --git a/brave/components/brave_today/browser/feed_parsing.cc b/brave/components/brave_today/browser/feed_parsing.cc
index 82a4a7205b..4369774a34 100644
--- a/brave/components/brave_today/browser/feed_parsing.cc
+++ b/brave/components/brave_today/browser/feed_parsing.cc
@@ -5,13 +5,13 @@
#include "brave/components/brave_today/browser/feed_parsing.h"
-#include <codecvt>
#include <string>
#include <utility>
#include <vector>
#include "base/json/json_reader.h"
#include "base/logging.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "brave/components/brave_today/common/brave_news.mojom-forward.h"
#include "brave/components/brave_today/common/brave_news.mojom-shared.h"
@@ -78,9 +78,8 @@ bool ParseFeedItem(const base::Value& feed_item_raw,
// Successful, get language-specific relative time
base::TimeDelta relative_time_delta =
base::Time::Now() - metadata->publish_time;
- std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> converter;
metadata->relative_time_description =
- converter.to_bytes(ui::TimeFormat::Simple(
+ base::UTF16ToUTF8(ui::TimeFormat::Simple(
ui::TimeFormat::Format::FORMAT_ELAPSED,
ui::TimeFormat::Length::LENGTH_LONG, relative_time_delta));
}
diff --git a/brave/components/brave_today/browser/direct_feed_controller.cc b/brave/components/brave_today/browser/direct_feed_controller.cc
index 70d232eb9b..815e0df867 100644
--- a/brave/components/brave_today/browser/direct_feed_controller.cc
+++ b/brave/components/brave_today/browser/direct_feed_controller.cc
@@ -6,7 +6,6 @@
#include "brave/components/brave_today/browser/direct_feed_controller.h"
#include <algorithm>
-#include <codecvt>
#include <iterator>
#include <memory>
#include <string>
@@ -20,6 +19,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "brave/components/brave_private_cdn/headers.h"
@@ -59,9 +59,8 @@ mojom::ArticlePtr RustFeedItemToArticle(const FeedItem& rust_feed_item) {
// Get language-specific relative time
base::TimeDelta relative_time_delta =
base::Time::Now() - metadata->publish_time;
- std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> converter;
metadata->relative_time_description =
- converter.to_bytes(ui::TimeFormat::Simple(
+ base::UTF16ToUTF8(ui::TimeFormat::Simple(
ui::TimeFormat::Format::FORMAT_ELAPSED,
ui::TimeFormat::Length::LENGTH_LONG, relative_time_delta));
auto article = mojom::Article::New();
|