[Interest] QWebSocket text methods should be utf8?

Thiago Macieira thiago.macieira at intel.com
Fri Feb 14 21:54:17 CET 2020

On Friday, 14 February 2020 11:13:24 PST Jason H wrote:
> After reviewing the QWebSocket spec ( https://tools.ietf.org/html/rfc6455 )
> text frames are supposed to be UTF-8 encoded, which would mean that
> QByteArray would be the proper class.

No, QString is the proper class because it's *text*. QWebSocket will convert 
from UTF-8 to UTF-16 and back for you.

> Now I'm having to toUtf8() all the things I receive, and QString() the ones
> I send. I am sure this leads to some degree of madness. I'm wondering if it
> would be possible to provide proper overloads: 
> - sendTextMessage(const QByteArray &message)
> - textMessageReceived(const QByteArray &message)
> - textFrameReceived(const QByteArray &frame, bool isLastFrame)


Feel free to pick up where I left off. I have absolutely no interest in web 
sockets so will not work on this.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products

More information about the Interest mailing list