You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Malin Ljungh <ma...@kvadrat.se> on 2006/11/05 21:04:13 UTC

Html encoding of messages?

Good evening everyone,

I wonder if I can get Tapestry to html encode my messages (from
properties-files)?
For example, replace the "&"-character with "&amp;".

Main

Re: Html encoding of messages?

Posted by Nick Westgate <ni...@key-planning.co.jp>.
> But, I've also started to wonder if I really need this - if I use utf-8 all
> the way I wouldn't need to use &aring; ?

Sure. From a previous thread you already had UTF-8 properties working, right?
So as long as the response output encoding is capable of displaying those
characters, you should see the properties strings exactly as given.

UTF-8 output encoding should be fine if your target browsers support it.

Cheers,
Nick.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Html encoding of messages?

Posted by Malin Ljungh <ma...@kvadrat.se>.
Build my own jars is not an option.
In that case I prefer the "&amp; &aring;" in my properties file and use the
raw option.

But, I've also started to wonder if I really need this - if I use utf-8 all
the way I wouldn't need to use &aring; ?


On 11/6/06, Craig St Jean <va...@earthlink.net> wrote:
>
> Maybe we need additional support in the MarkupCharacterTranslator?
> I'm very new to Tapestry so I of course cannot make this decision,
> but it would solve this issue and any possible others that are
> similar. Anyone here familiar with the steps required to modify this
> class? I'm not familiar with how source modifications go here.
> Possibly an e-mail to the dev mailing list with the code for the patch?
>
> Malin, in the mean time (a bad solution) you could modify the
> ENTITIES in the MarkupCharacterTranslator and rebuild your tapestry
> jars. Again I stress this is not a good solution as your patch would
> need to be applied on every update and you would need your own jars
> for every server, however possibly as a temporary solution?
>
> On Nov 6, 2006, at 2:03 AM, Malin Ljungh wrote:
>
> > Thank you Nick. I've read the docs, and I think I've understand it.
> > Maybe
> > I've missed something?
> >
> > The thing is:
> > If I have a message like this: "& å"
> > it will translate it to "&amp; å"
> > or, with the raw="true" option I will get "& å"
> >
> > But! What I want (as output) is this: "&amp; &aring;"
> > As I see it, to get this, I need to put "&amp; &aring;" in my
> > properties
> > file and use the raw option.
> > But I would rather put "& å" in my properties file... but that's not
> > possible?
> >
> > Malin
> >
> > On 11/6/06, Nick Westgate <ni...@key-planning.co.jp> wrote:
> >>
> >> Hi Malin.
> >>
> >> Malin Ljungh wrote:
> >> > Craig, I've tried it... unfortunately it does replace &aring;
> >> with the
> >> > &amp;aring;
> >>
> >> Of course it does. Otherwise your messages might contain
> >> unintentional
> >> HTML.
> >>
> >> It's always a good idea to read the docs first:
> >>
> >> http://tapestry.apache.org/tapestry4.1/usersguide/
> >> template.html#Localization
> >>
> >> The <span> shortcut has a raw="true" option, just like @Insert.
> >>
> >> Cheers,
> >> Nick.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Html encoding of messages?

Posted by Craig St Jean <va...@earthlink.net>.
Maybe we need additional support in the MarkupCharacterTranslator?  
I'm very new to Tapestry so I of course cannot make this decision,  
but it would solve this issue and any possible others that are  
similar. Anyone here familiar with the steps required to modify this  
class? I'm not familiar with how source modifications go here.  
Possibly an e-mail to the dev mailing list with the code for the patch?

Malin, in the mean time (a bad solution) you could modify the  
ENTITIES in the MarkupCharacterTranslator and rebuild your tapestry  
jars. Again I stress this is not a good solution as your patch would  
need to be applied on every update and you would need your own jars  
for every server, however possibly as a temporary solution?

On Nov 6, 2006, at 2:03 AM, Malin Ljungh wrote:

> Thank you Nick. I've read the docs, and I think I've understand it.  
> Maybe
> I've missed something?
>
> The thing is:
> If I have a message like this: "& å"
> it will translate it to "&amp; å"
> or, with the raw="true" option I will get "& å"
>
> But! What I want (as output) is this: "&amp; &aring;"
> As I see it, to get this, I need to put "&amp; &aring;" in my  
> properties
> file and use the raw option.
> But I would rather put "& å" in my properties file... but that's not
> possible?
>
> Malin
>
> On 11/6/06, Nick Westgate <ni...@key-planning.co.jp> wrote:
>>
>> Hi Malin.
>>
>> Malin Ljungh wrote:
>> > Craig, I've tried it... unfortunately it does replace &aring;  
>> with the
>> > &amp;aring;
>>
>> Of course it does. Otherwise your messages might contain  
>> unintentional
>> HTML.
>>
>> It's always a good idea to read the docs first:
>>
>> http://tapestry.apache.org/tapestry4.1/usersguide/ 
>> template.html#Localization
>>
>> The <span> shortcut has a raw="true" option, just like @Insert.
>>
>> Cheers,
>> Nick.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Html encoding of messages?

Posted by Malin Ljungh <ma...@kvadrat.se>.
Thank you Nick. I've read the docs, and I think I've understand it. Maybe
I've missed something?

The thing is:
If I have a message like this: "& å"
it will translate it to "&amp; å"
or, with the raw="true" option I will get "& å"

But! What I want (as output) is this: "&amp; &aring;"
As I see it, to get this, I need to put "&amp; &aring;" in my properties
file and use the raw option.
But I would rather put "& å" in my properties file... but that's not
possible?

Malin

On 11/6/06, Nick Westgate <ni...@key-planning.co.jp> wrote:
>
> Hi Malin.
>
> Malin Ljungh wrote:
> > Craig, I've tried it... unfortunately it does replace &aring; with the
> > &amp;aring;
>
> Of course it does. Otherwise your messages might contain unintentional
> HTML.
>
> It's always a good idea to read the docs first:
>
> http://tapestry.apache.org/tapestry4.1/usersguide/template.html#Localization
>
> The <span> shortcut has a raw="true" option, just like @Insert.
>
> Cheers,
> Nick.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Html encoding of messages?

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Hi Malin.

Malin Ljungh wrote:
> Craig, I've tried it... unfortunately it does replace &aring; with the
> &amp;aring;

Of course it does. Otherwise your messages might contain unintentional HTML.

It's always a good idea to read the docs first:
http://tapestry.apache.org/tapestry4.1/usersguide/template.html#Localization

The <span> shortcut has a raw="true" option, just like @Insert.

Cheers,
Nick.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Html encoding of messages?

Posted by Malin Ljungh <ma...@kvadrat.se>.
Craig, I've tried it... unfortunately it does replace &aring; with the
&amp;aring;
And it does not replace å with &aring;

Also, I've noticed problems with these characters in the ValidationString
files. Here I use \u00e5 but should that really be necessary?


On 11/5/06, Craig St Jean <va...@earthlink.net> wrote:
>
> &aring; will not be replaced with &amp;aring;, &aring; is the already
> encoded version, not the to be encoded version.
>
> On Nov 5, 2006, at 3:38 PM, Malin Ljungh wrote:
>
> > But that won't work either of course... &aring; will be replaced with
> > &amp;aring;...
> >
> >
> > On 11/5/06, Malin Ljungh <ma...@kvadrat.se> wrote:
> >>
> >> Well, I use either
> >> <span key="messagekey">
> >> or the @Insert (but the former is an @Insert also I think).
> >>
> >> I see now I gave a really bad example. The & -> &amp; works. But
> >> Swedish
> >> characters, like å -> &aring; doesn't.
> >>
> >> So I guess I need to enter this in my properties files?
> >>
> >> Malin
> >>
> >> On 11/5/06, andyhot <andyhot@di.uoa.gr > wrote:
> >> >
> >> > Malin Ljungh wrote:
> >> > > Good evening everyone,
> >> > >
> >> > > I wonder if I can get Tapestry to html encode my messages (from
> >> > > properties-files)?
> >> > > For example, replace the "&"-character with "&amp;".
> >> > >
> >> > > Main
> >> > >
> >> > Aren't you using the @Insert component to output your messages?
> >> > It automatically does this encoding.
> >> >
> >> > --
> >> > Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
> >> > Tapestry / Tacos developer
> >> > Open Source / J2EE Consulting
> >> >
> >> >
> >> >
> >> ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> > For additional commands, e-mail: users-help@tapestry.apache.org
> >> >
> >> >
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Html encoding of messages?

Posted by Craig St Jean <va...@earthlink.net>.
&aring; will not be replaced with &amp;aring;, &aring; is the already  
encoded version, not the to be encoded version.

On Nov 5, 2006, at 3:38 PM, Malin Ljungh wrote:

> But that won't work either of course... &aring; will be replaced with
> &amp;aring;...
>
>
> On 11/5/06, Malin Ljungh <ma...@kvadrat.se> wrote:
>>
>> Well, I use either
>> <span key="messagekey">
>> or the @Insert (but the former is an @Insert also I think).
>>
>> I see now I gave a really bad example. The & -> &amp; works. But  
>> Swedish
>> characters, like å -> &aring; doesn't.
>>
>> So I guess I need to enter this in my properties files?
>>
>> Malin
>>
>> On 11/5/06, andyhot <andyhot@di.uoa.gr > wrote:
>> >
>> > Malin Ljungh wrote:
>> > > Good evening everyone,
>> > >
>> > > I wonder if I can get Tapestry to html encode my messages (from
>> > > properties-files)?
>> > > For example, replace the "&"-character with "&amp;".
>> > >
>> > > Main
>> > >
>> > Aren't you using the @Insert component to output your messages?
>> > It automatically does this encoding.
>> >
>> > --
>> > Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
>> > Tapestry / Tacos developer
>> > Open Source / J2EE Consulting
>> >
>> >
>> >  
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Html encoding of messages?

Posted by Malin Ljungh <ma...@kvadrat.se>.
But that won't work either of course... &aring; will be replaced with
&amp;aring;...


On 11/5/06, Malin Ljungh <ma...@kvadrat.se> wrote:
>
> Well, I use either
> <span key="messagekey">
> or the @Insert (but the former is an @Insert also I think).
>
> I see now I gave a really bad example. The & -> &amp; works. But Swedish
> characters, like å -> &aring; doesn't.
>
> So I guess I need to enter this in my properties files?
>
> Malin
>
> On 11/5/06, andyhot <andyhot@di.uoa.gr > wrote:
> >
> > Malin Ljungh wrote:
> > > Good evening everyone,
> > >
> > > I wonder if I can get Tapestry to html encode my messages (from
> > > properties-files)?
> > > For example, replace the "&"-character with "&amp;".
> > >
> > > Main
> > >
> > Aren't you using the @Insert component to output your messages?
> > It automatically does this encoding.
> >
> > --
> > Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
> > Tapestry / Tacos developer
> > Open Source / J2EE Consulting
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>

Re: Html encoding of messages?

Posted by Malin Ljungh <ma...@kvadrat.se>.
Well, I use either
<span key="messagekey">
or the @Insert (but the former is an @Insert also I think).

I see now I gave a really bad example. The & -> &amp; works. But Swedish
characters, like å -> &aring; doesn't.

So I guess I need to enter this in my properties files?

Malin

On 11/5/06, andyhot <an...@di.uoa.gr> wrote:
>
> Malin Ljungh wrote:
> > Good evening everyone,
> >
> > I wonder if I can get Tapestry to html encode my messages (from
> > properties-files)?
> > For example, replace the "&"-character with "&amp;".
> >
> > Main
> >
> Aren't you using the @Insert component to output your messages?
> It automatically does this encoding.
>
> --
> Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
> Tapestry / Tacos developer
> Open Source / J2EE Consulting
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Html encoding of messages?

Posted by andyhot <an...@di.uoa.gr>.
Malin Ljungh wrote:
> Good evening everyone,
>
> I wonder if I can get Tapestry to html encode my messages (from
> properties-files)?
> For example, replace the "&"-character with "&amp;".
>
> Main
>
Aren't you using the @Insert component to output your messages?
It automatically does this encoding.

-- 
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org