A
A
AlexSer2020-04-13 17:24:16
Qt
AlexSer, 2020-04-13 17:24:16

QT and Cyrillic in COM?

Hello!! I receive data from the COM port. The device transmits data in Cyrillic.
Accordingly, I have krakozyabry. How can I fix it?
Used TextCodec but doesn't help.
Here is the code:

QString byte;
   QByteArray data;
   byte=serialPort->readAll();
   data+=byte;
   QTextCodec::setCodecForLocale(QTextCodec::codecForName("Windows-1251"));
   QString cyrillicName = QString::fromLocal8Bit(data);

Can you suggest how to solve this problem.
QT files are all UTF-8 encoded without BOM

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2020-04-13
@gbg

First, figure out in what encoding these characters come to you.
At a minimum, the encoding is called cp1251 , not what you wrote.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question