Project

General

Profile

Actions

Feature #1748

open

WLineEdit::setEmptyText() (among other methods) should _also_ accept WText:: class strings

Added by Vincenzo Romano about 11 years ago. Updated about 11 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
03/11/2013
Due date:
% Done:

0%

Estimated time:

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.

Actions #1

Updated by Koen Deforche about 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

Actions #2

Updated by Koen Deforche about 11 years ago

  • Status changed from New to Feedback
Actions #3

Updated by Koen Deforche about 11 years ago

  • Target version deleted (3.3.0)
Actions

Also available in: Atom PDF