You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Simon Kittle <si...@kittle.co.uk> on 2006/12/23 20:10:45 UTC
Strings being encoded HTML safe.
Hey,
I'm having a bit of trouble figuring out some encoding details. I'm using
Velocity on a site, and I've got a string with some double quote characters
in it: ".
If I send this string to velocity in simply a single variable, say,
$testString, then these quote characters come through completely raw
(they're not encoded into ").
However, if this string is part of a Java object, and I send them to
velocity via the object the " characters are encoded to "
So if I had:
String testString = "\"this string has some \" characters";
testObject.someString = "\"this string has some \" characters";
And I put them into velocity, in the same place in the template:
testString: $testString
<br>
testObject.someString: $testObject.someString
Then in the HTML generated I get this:
"this string has some " characters
"this string has some " characters
Is there a reason why this would happen in such a way? And if so, are there
any docs on this stuff? I've looked in the user guide but am no more
clueful. I did browse a few months of mailing list archives but couldn't
find a search function.
Thanks
Si
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: Strings being encoded HTML safe.
Posted by Nathan Bubna <nb...@gmail.com>.
What version of Velocity are you using? Are you using any event
handlers or anything? This is not standard Velocity behavior. You'll
have to give us some more of your config/impl details.
On 12/23/06, Simon Kittle <si...@kittle.co.uk> wrote:
> Hey,
>
> I'm having a bit of trouble figuring out some encoding details. I'm using
> Velocity on a site, and I've got a string with some double quote characters
> in it: ".
>
> If I send this string to velocity in simply a single variable, say,
> $testString, then these quote characters come through completely raw
> (they're not encoded into ").
>
> However, if this string is part of a Java object, and I send them to
> velocity via the object the " characters are encoded to "
>
> So if I had:
>
> String testString = "\"this string has some \" characters";
> testObject.someString = "\"this string has some \" characters";
>
> And I put them into velocity, in the same place in the template:
>
> testString: $testString
> <br>
> testObject.someString: $testObject.someString
>
> Then in the HTML generated I get this:
>
> "this string has some " characters
> "this string has some " characters
>
> Is there a reason why this would happen in such a way? And if so, are there
> any docs on this stuff? I've looked in the user guide but am no more
> clueful. I did browse a few months of mailing list archives but couldn't
> find a search function.
>
> Thanks
>
> Si
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org