Bug #1242
closedWApplication::setTitle double quotes text
0%
Description
Hi,
When I pass a string containing & to setTitle(), it ends up as & in the title.
Kurt
Files
Updated by Kurt Roeckx over 13 years ago
addMetaHeader() has the same effect
Kurt
Updated by Wim Dumon over 13 years ago
- Status changed from New to Feedback
Kurt,
I've modified hello.C to read:
setTitle("Hello & world");
and that works as expected, i.e. the title shows
Hello & world
That's how it should work (setTitle() is not a function that you can pass XHTML to).
If you see something different, what version of Wt are you using? Which browser?
Wim.
Updated by Kurt Roeckx over 13 years ago
- File hello.html hello.html added
Wim Dumon wrote:
Kurt,
I've modified hello.C to read:
[...]and that works as expected, i.e. the title shows
[...]That's how it should work (setTitle() is not a function that you can pass XHTML to).
If you see something different, what version of Wt are you using? Which browser?
So I tried exactly the same, and the generate html has "Hello & world", and so the browser window title shows "Hello & world" while I was expecting "Hello & world"
I'm testing this in wt 3.2.1, I don't think the browser is relevant. I've attached the output html file.
Updated by Wim Dumon over 13 years ago
Hello Kurt,
The output you see is what I have seen and what is expected. setTitle() does not expect XML, so it will properly escape all symbols that need to be escaped to make your text render correctly (&, <, >, ...).
If you want to see "Hello & World" as title, you'll need to render your XML string to a plain string. As far as I know, Wt does not include a method to do so.
Wim.
Updated by Koen Deforche over 13 years ago
- Status changed from Feedback to Closed