mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
gix bug by updating cppcommon/str_functs.cpp
This commit is contained in:
parent
92e5234b4a
commit
1e246d6bb8
@ -149,7 +149,7 @@ namespace CppJieba
|
||||
|
||||
bool KeyWordExt::extract(const string& utf8Str, vector<string>& keywords, uint topN)
|
||||
{
|
||||
LogInfo(string_format("title:[%s]",utf8Str.c_str()));
|
||||
LogDebug(string_format("title:[%s]",utf8Str.c_str()));
|
||||
|
||||
bool retFlag;
|
||||
vector<string> words;
|
||||
@ -177,7 +177,7 @@ namespace CppJieba
|
||||
}
|
||||
//LogDebug("_extractTopN finished.");
|
||||
|
||||
LogInfo(string_format("ext res:[%s]", joinStr(keywords, ",").c_str()));
|
||||
LogDebug(string_format("ext res:[%s]", joinStr(keywords, ",").c_str()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -331,14 +331,18 @@ namespace CPPCOMMON
|
||||
string gbkToUtf8(const string& gbk)
|
||||
{
|
||||
//cout<<__FILE__<<__LINE__<<gbk<<endl;
|
||||
string res;
|
||||
if(gbk.empty())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
string res("");
|
||||
size_t maxLen = gbk.size()*4;
|
||||
char * pUtf = new char[maxLen];
|
||||
int ret = code_convert("gbk", "utf-8", (char *)gbk.c_str(), gbk.size(), pUtf, maxLen);
|
||||
if(ret == -1)
|
||||
{
|
||||
delete [] pUtf;
|
||||
return "";
|
||||
return res;
|
||||
}
|
||||
res = pUtf;
|
||||
delete [] pUtf;
|
||||
|
Loading…
x
Reference in New Issue
Block a user