[Interest] QWebSocket text methods should be utf8?

Konstantin Tokarev annulen at yandex.ru
Mon Feb 17 13:40:35 CET 2020

14.02.2020, 23:56, "Thiago Macieira" <thiago.macieira at intel.com>:
> 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.

FWIW, having to do useless transcoding just to use an API doesn't fit into my
definition of "proper".

>>  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)
> https://codereview.qt-project.org/c/qt/qtwebsockets/+/268194
> 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
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest


More information about the Interest mailing list