开发者社区> 问答> 正文

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:34:07 2505 0
1 条回答
写回答
取消 提交回答
  • 是连接不上吗,还有更详细的错误信息没?比如连接的返回信息?
    2017-11-30 00:31:03
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
复杂声学环境下的语音交互:技术与实践 立即下载
你好,Pal——阿里智能全新语音交互解决方案 立即下载
复杂升学环境下的语言交互:技术与实践 立即下载