A
A
AlexSer2020-03-10 19:22:14
Qt
AlexSer, 2020-03-10 19:22:14

QT serial and Cyrillic?

I accept data from serial;
debug displays data array

"\x05\x02"
"1H|\\^&|||Analyzer ID|||||HOST||1|20200310164552\r\x03""5A\r\x02"
"2P|1| |||||||||||^\r\x03""E9\r\x02"
"3O|1|^1^1^31|||R|20200310131455|||||||| |1||||||||||O\r\x03""4C\r\x02""4R|1|^^^\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\ xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD|5.1|\xEF\xBF \xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD/\xEF\xBF\xBD|0.5^5.2\\^|||F||||20200310131455\ r\x03""6D\r\x02"
"5R|2|^^^\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\ xEF\xBF\xBD\xEF\xBF\xBD|6.28|\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD/\xEF\xBF\ xBD|3.8^6.

Russian characters are not displayed, how to fix?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2020-03-10
@gbg

I think it's cp1251, so you need to create a codec for it and use it:

auto cdc=QTextCodec::codecForName("CP1251");
QByteArray in;
QString text=cdc->toUnicode(in);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question