问题:
iot_device 移植到嵌入式开发板出现错误.
setText:56 convert to utf8 error, error code is 9
我的师傅说 本来就是utf的编码不用转换.,
void setText(const string &text) {
#ifdef _WINDOWS_COMPILE_ this->text = Log::GBKToUTF8(text);
#elif _GNU_ vector<char> outbuf(text.length()*20+1,0);
size_t len = text.length()*20; vector<char> inbuf(text.begin(),text.end());
int res= Log::code_convert("GBK","UTF-8",&inbuf[0],text.length(),&outbuf[0],len); //int res = 1;
if(res == -1) {
LOG_ERROR("convert to utf8 error, error code is %d",errno); }
this->text = string(outbuf.begin(),outbuf.end());//********************** 自己改测试********************************
if(res == -1) {
this->text = text; }
//*************************************************************#else
this->text = text;#endif
}
log 信息
>>> ./nls-service tts test.wav
2017-11-28 16:17:16 AliYunNLS_SDK(ERROR): setText:56 convert to utf8 error, error code is 9
2017-11-28 16:17:16 AliYunNLS_SDK(ERROR): setText:56 convert to utf8 error, error code is 9
2017-11-28 16:17:16 AliYunNLS_SDK(DEBUG): ConnectToHttp:116 send http head to server
2017-11-28 16:17:16 AliYunNLS_SDK(DEBUG): ConnectToHttp:116 send http head to server
2017-11-28 16:17:16 AliYunNLS_SDK(DEBUG): ConnectToHttp:133 receive http status response from server
2017-11-28 16:17:16 AliYunNLS_SDK(DEBUG): ConnectToHttp:147 receive http head response from server
2017-11-28 16:17:16 AliYunNLS_SDK(DEBUG): ConnectToHttp:133 receive http status response from server
2017-11-28 16:17:16 AliYunNLS_SDK(DEBUG): ConnectToHttp:147 receive http head response from server
但是会一直卡在这里.求解.求大佬
原文件在这里
https://help.aliyun.com/document_detail/50300.html?spm=5176.product30413.6.551.sOF8sV
log.cpp 定位错误
cd = iconv_open(to_charset,from_charset);
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。