summaryrefslogtreecommitdiff
path: root/src/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/utils.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utils.cpp b/src/utils.cpp
index 8ca5cdb5..c7c86dbc 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -17,6 +17,8 @@
#include <curl/curl.h>
+#include <stfl.h>
+
namespace newsbeuter {
std::vector<std::string> utils::tokenize_quoted(const std::string& str, std::string delimiters) {
@@ -490,6 +492,13 @@ std::string utils::replace_all(std::string str, const std::string& from, const s
return str;
}
+std::wstring utils::utf8str2wstr(const std::string& utf8str) {
+ stfl_ipool * pool = stfl_ipool_create("utf-8");
+ std::wstring wstr(stfl_ipool_towc(pool, utf8str.c_str()));
+ stfl_ipool_destroy(pool);
+ return wstr;
+}
+
std::wstring utils::str2wstr(const std::string& str) {
const char* pszExt = str.c_str();
wchar_t pwszInt [str.length()+1];