[Development] Oslo, we have a problem</apollo 13> [char8_t]

Edward Welbourne edward.welbourne at qt.io
Mon Jul 8 11:03:54 CEST 2019


Thiago had observed:
>>> Arguably, toUpper() and toLower() should be removed, since
>>>
>>>      QByteArray(u8"Résumé").toLower()
>>> is mojibake.

вс, 7 июл. 2019 г., 12:58 André Hartmann <aha_1980 at gmx.de<mailto:aha_1980 at gmx.de>>:
>> I vote against that. If you got the "raw" data from a device as
>> described above, you might want to do .toHex().toUpper() which is fully valid.

Konstantin Ritt (8 July 2019 04:26) replied:
> I'd argue against validity of the `ba.toHex().toUpper()` example, as
> it brings false impression that you're operating on a string, where in
> fact your intention is to re-code the binary data from one encoded
> form to another encoded form (ASCII in this case, and one would have
> to `QString::fromLatin1()` it explicitly to manipulate it further).
> From the other hand, `ba.toHex(Uppercase)` enforces the reader to
> treat it exactly like an uppercased hex (whatever that means), which
> is just another encoding form of the binary data.

My thought exactly: we can, at least, add this overload to toHex().
Historical baggage precludes removing (or deprecating) the traditional
path, but we can at least add the path that avoids use of a suspect API.

	Eddy.


More information about the Development mailing list