[Catalyst] html escaping question

Mario Minati mario.minati at googlemail.com
Wed Mar 21 14:29:02 GMT 2007


Am Mittwoch 21 März 2007 15:01 schrieb Carl Franks:
> On 21/03/07, Mario Minati <mario.minati at googlemail.com> wrote:
> > Am Mittwoch 21 März 2007 12:42 schrieb Carl Franks:
> > > In which case you may be double-escaping.
> >
> > But how can I circumvent this. Actually it's not a clever question.
> > Is it usefull to circumvent that.
> >
> > My current problem:
> > As the part of my project I am working on at moment deals with companies
> > I have to deal with "GmbH & Co. KG" which is a quite popular type of
> > company in Germany.
> >
> > If a users types that in a form field everything is fine until it comes
> > to editing. The string is escaped - of course. But the user is confused
> > when he sees "GmbH &amp; Co. KG".
>
> Find out which part of your app is double-escaping, and stop it.
> If your template has just [% form %] there shouldn't be any problem.
>
> By default, a field with:
>     default_value('GmbH & Co')
> will render as:
>     value="Gmbh &amp; Co"
> the user will see the value as:
>     GmbH & Co
> and when it's submitted, the server will see:
>     GmbH & Co

You were right, as always ;-)

I used the FormFu HTMLEscape Filter and the $amp; in the database got encode a 
second time while form processing.

Thanks again,
Mario



More information about the Catalyst mailing list