gpt4 book ai didi

c++ - utext_openUTF8 返回字符串 "mod-12k"的错误;

转载 作者:行者123 更新时间:2023-11-28 07:56:24 26 4
gpt4 key购买 nike

在下面的小程序中,我无法弄清楚为什么 utext_openUTF8 返回错误..

  int utf8_is_it_model3(std::string input_string)
{
int error_number=0;
UText *ut = NULL;
UErrorCode status;

//char *pEnd;
const char * c2 = input_string.c_str();
ut = utext_openUTF8(ut, c2, -1, &status);
if(U_FAILURE(status))
{
error_number=-1
std::cout<<" Error!\n";
return error_number;
}



utext_close(ut);

return error_number;

}

int main(int argc, char* argv[])
{
int i;
bool is_it_model=false;
std::string input_string="mod-12k";
//std::string input_string="m54-q";
//std::string input_string="- ";
i=utf8_is_it_model3(input_string);

return 0;
}

输出: 错误!

当我改变 std::string input_string="mod-12k";与 std::string input_string="sko-w";我没有错误...

我正在使用 ubuntu 64 位 12.04 和 c++ 以及 ICU 49

我不知道我做错了什么......

最佳答案

真正的问题是你需要在第 5 行:

UErrorCode status = U_ZERO_ERROR;

关于c++ - utext_openUTF8 返回字符串 "mod-12k"的错误;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12621403/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com