lemanhtrung / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

How to transfer Chinese characters? #126

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
How to transfer Chinese characters? In the examples,Chinese characters 
become to be ????.

Original issue reported on code.google.com by yxgu...@gmail.com on 10 Apr 2012 at 2:50

GoogleCodeExporter commented 9 years ago
QextSerailPort (and all other IO Device) can only deal with byte-stream.

If you want to transfer Chinese characters, select a proper textcodec which can 
deal with chinese, for example: gb18030, utf8, big-5, ...

Then when you write into the IO Device, convert your QString to QByteArray; 
when you receive data, convert the QByteArray back to QString.

In examples of QextSerialPort, "latin1" is used.

Original comment by dbzhang...@gmail.com on 10 Apr 2012 at 3:58

GoogleCodeExporter commented 9 years ago
Thank you! BTW, How to send ESC (0x1b) using port->write()?

Original comment by yxgu...@gmail.com on 10 Apr 2012 at 9:09