Feature #1748
openWLineEdit::setEmptyText() (among other methods) should _also_ accept WText:: class strings
0%
Description
As I need to place some non-ASCII text, I'm constantly using code like this:
edit->setEmptyText( WText( "Input quì" ).text() );
In my opinion, whenever you have some sort of string that needs to be mapped (more or less directly) into an HTML document, it'd be possible to set it up as WText and not WString.
Updated by Koen Deforche over 11 years ago
Hey Vincenzo,
Rather than using HTML entitities, Wt supports unicode text (e.g. UTF-8 formatted text). The only catch is that C doesn't support this (yet) reliably in source code, that's why we usually put constants/literals in message resource bundles (xml) files.
WText( "Input quì" ).text() will use an (expensive) XML parsing step (for XSS filtering) which has as side effect the translation of XML/HTML entitities into proper unicode (UTF-8) text. I'm not sure if it makes sense to make the entity decoding more accessible in the API.
Depending on the platform you are on, and the editor you are using, Wt::WString::fromUTF8("Input quì"), could also work. With C++11 this non-portability should be addressed but I'm not sure entirely how.
Regards,
koen