开发者社区> 问答> 正文

iotdevice



问题:
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);  





展开
收起
rokid 2017-11-28 16:31:25 2339 0
1 条回答
写回答
取消 提交回答
  • 不转换是什么错误啊
    2017-11-29 00:22:35
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载