cutecom 中文显示临时解决方案
tio -m INLCRNL /dev/ttyUSB0
minicom
关键词 QByteArray QString
git clone https://gitee.com/spyy26224574/cutecom
cd cutecom
cmake .
make
http://cutecom.sourceforge.net/
https://sourceforge.net/p/cutecom/code/HEAD/tree/
https://gitlab.com/cutecom/cutecom/-/blob/master/datadisplay.cpp
https://github.com/neundorf/CuteCom
修改datadisplay.cpp
#include
void DataDisplay::constructDisplayLine(const QByteArray &inData)
{
DisplayLine line;
if (m_previous_ended_with_nl) {
m_timestamps->append(m_timestamp);
}
QTextCodec *pUtf8 = QTextCodec::codecForName("UTF-8");/*请教QT大神 此处内存会泄漏吗?*/
line.data = pUtf8->toUnicode(inData);
if (!line.data.isEmpty()) {
m_data.append(line);
m_previous_ended_with_nl = line.data.endsWith('\n');
}
}
伪代码
取数组 第一个 换行 回车 啥的 复制给新的 数组 然后整体转码
然后追加 换行 回车 啥的
参考
utf-8码表 https://www.utf8-chartable.de/
由此得出 一个中文3字节。
https://blog.csdn.net/libaineu2004/article/details/19245205
https://blog.csdn.net/xxm524/article/details/74937308
https://blog.csdn.net/xyyangkun/article/details/7382823