Vadim Zeitlin
unread,May 25, 2024, 10:58:39 AMMay 25Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to wx-...@googlegroups.com
On Sat, 25 May 2024 07:46:02 -0700 (PDT) Andrey Moura wrote:
AM> In my application I have to call str.ToStdString() and then copy the
AM> characters to a std::u8string cause there's no conversion from std::string
AM> to std::u8string, then expending time on a non needed copy.
IMNSHO std::u8string was a mistake exactly because it doesn't provide any
conversion -- other than by copying its contents -- to std::string. So
personally I just don't use it and always std::string directly with the
understanding that it always contains UTF-8 data.
AM> My idea is to implement str.ToStdU8String() which does exactly the same
AM> as ToStdString(), but returns the result in a std::u8string. Also, a
AM> wxString::operator=(u8string) will be needed. Obviously, I will check
AM> for support to std::u8string.
AM>
AM> I will implement on my local copy cause I really need it. If you think
AM> that's a good idea, please let me know to create PR on GitHub.
But if people really want to use std::u8string, why not, it shouldn't cost
us much to have it, so if you're motivated to do it, please go ahead.
However my advice would be to just avoid std::u8string (and char8_t).
Regards,
VZ