From 4ec51432ee14a03b31e046f91f3f6843a8738a6d Mon Sep 17 00:00:00 2001 From: Andreas Krennmair Date: Tue, 11 Mar 2008 13:10:25 +0000 Subject: Andreas Krennmair: fixed issue related to string conversion. --- src/utils.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/utils.cpp') 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 +#include + namespace newsbeuter { std::vector 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]; -- cgit v1.2.3