[Development] Why can't QString use UTF-8 internally?

Matthew Woehlke mw_triad at users.sourceforge.net
Wed Feb 11 01:07:09 CET 2015


On 2015-02-10 18:33, Thiago Macieira wrote:
> Eh... have you tried to convert a UTF-8 or UTF-16 or UCS-4 string to the 
> locale's narrow character set without using QString?

Yup... we would need to standardize libiconv (or an equivalent) for that
:-).

> Have you tried to convert a number to string? You need C++14 to do that 
> reasonably, since std::to_string didn't exist in C++11. How about the reverse? 
> The only way to do that is sscanf or std::istringstream.

(OT: What happened to the proposal for that? Did it die from
overengineering?)

> We may want to have this discussion for QVector vs std::vector. For QString 
> and QByteArray, there's no discussion: they stay, period.

Heh. That reminds me, when will Qt classes get emplace methods? Or the
ability to accept movable-but-not-copyable types? (Or did they? Last I
checked, one or both were issues in 5.4 at least...) This is the only
reason I am (grudgingly) using STL classes for my unique_ptr's.

(Something else to consider for Qt 6 would be fixing the index types to
be size_t instead of int. Assuming we don't just drop the classes.)

-- 
Matthew




More information about the Development mailing list