Avoiding html entities for special characters

155 views
Skip to first unread message

Debilski

unread,
Jan 16, 2011, 11:36:04 AM1/16/11
to lif...@googlegroups.com
Hi,
currently when using non-ascii input, it seems that Lift tries to replace as many characters as possible with their html entity. E.g. an input ä will generate ä in the output. The same seems to be true for more esoteric entities as well. On the other hand, if there is no entity available, the character will be left untouched as utf-8. (You can easily find out by experimenting with the chat on the lift demo site.)

Is it possible that Lift does not make any conversion at all? It’s not necessary in a properly utf-8’ed document anyway.

Cheers,
/rike

David Pollak

unread,
Jan 16, 2011, 11:57:59 AM1/16/11
to lif...@googlegroups.com
Are you using XHTML or Html5?

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
Surf the harmonics

David Pollak

unread,
Jan 16, 2011, 12:01:55 PM1/16/11
to lif...@googlegroups.com
  /**
   * Should codes that represent entities be converted to XML
   * entities when rendered?
   */
  val convertToEntity: FactoryMaker[Boolean] = new FactoryMaker(false) {}

Set this to true and the entities will not be converted.

On Sun, Jan 16, 2011 at 8:36 AM, Debilski <rikebenjami...@googlemail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

Debilski

unread,
Jan 16, 2011, 1:33:35 PM1/16/11
to Lift


On 16 Jan., 18:01, David Pollak <feeder.of.the.be...@gmail.com> wrote:
>   /**
>    * Should codes that represent entities be converted to XML
>    * entities when rendered?
>    */
>   val convertToEntity: FactoryMaker[Boolean] = new FactoryMaker(false) {}
>
> Set this to true and the entities will not be converted.

Thanks. Unfortunately, it won’t be applied in HTML5 output mode which
I’m using. (I’m also using XHTML input but I think that does not make
a difference here.)

> On Sun, Jan 16, 2011 at 8:36 AM, Debilski <
>
>
>
>
>
> rikebenjamin.schupp...@googlemail.com> wrote:
> > Hi,
> > currently when using non-ascii input, it seems that Lift tries to replace
> > as many characters as possible with their html entity. E.g. an input ä will
> > generate &auml; in the output. The same seems to be true for more esoteric
> > entities as well. On the other hand, if there is no entity available, the
> > character will be left untouched as utf-8. (You can easily find out by
> > experimenting with the chat on the lift demo site.)
>
> > Is it possible that Lift does not make any conversion at all? It’s not
> > necessary in a properly utf-8’ed document anyway.
>
> > Cheers,
> > /rike
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lif...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com >
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=en.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890

Christopher Taylor

unread,
Jan 16, 2011, 1:46:50 PM1/16/11
to lif...@googlegroups.com

On 16.01.2011, at 18:01, David Pollak wrote:

> /**
> * Should codes that represent entities be converted to XML
> * entities when rendered?
> */
> val convertToEntity: FactoryMaker[Boolean] = new FactoryMaker(false) {}
>
> Set this to true and the entities will not be converted.

Was that a typo? I'd expect

if (convertToEntity) {
// will be converted to entities
} else {
// won't be converted
}

Regards,
--Chris

David Pollak

unread,
Jan 16, 2011, 10:42:14 PM1/16/11
to lif...@googlegroups.com
On Sun, Jan 16, 2011 at 10:33 AM, Debilski <rikebenjami...@googlemail.com> wrote:


On 16 Jan., 18:01, David Pollak <feeder.of.the.be...@gmail.com> wrote:
>   /**
>    * Should codes that represent entities be converted to XML
>    * entities when rendered?
>    */
>   val convertToEntity: FactoryMaker[Boolean] = new FactoryMaker(false) {}
>
> Set this to true and the entities will not be converted.

Thanks. Unfortunately, it won’t be applied in HTML5 output mode which
I’m using. (I’m also using XHTML input but I think that does not make
a difference here.)

You'll have to write your own custom Html5 emitter to avoid getting the entities escaped.

Feel free to open a ticket on this issue and I'll do what I can to write one for you, but it won't get into Lift until at least 2.3-M1
 
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.




--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890

Debilski

unread,
Jan 17, 2011, 4:04:42 AM1/17/11
to Lift


On Jan 17, 4:42 am, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> On Sun, Jan 16, 2011 at 10:33 AM, Debilski <
>
>
>
>
>
> rikebenjamin.schupp...@googlemail.com> wrote:
>
> > On 16 Jan., 18:01, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> > >   /**
> > >    * Should codes that represent entities be converted to XML
> > >    * entities when rendered?
> > >    */
> > >   val convertToEntity: FactoryMaker[Boolean] = new FactoryMaker(false) {}
>
> > > Set this to true and the entities will not be converted.
>
> > Thanks. Unfortunately, it won’t be applied in HTML5 output mode which
> > I’m using. (I’m also using XHTML input but I think that does not make
> > a difference here.)
>
> You'll have to write your own custom Html5 emitter to avoid getting the
> entities escaped.
>
> Feel free to open a ticket on this issue and I'll do what I can to write one
> for you, but it won't get into Lift until at least 2.3-M1
>

Done. http://www.assembla.com/spaces/liftweb/tickets/853-make-html5writer-aware-of-liftrules-converttoentity

>
>
>
> > > On Sun, Jan 16, 2011 at 8:36 AM, Debilski <
>
> > > rikebenjamin.schupp...@googlemail.com> wrote:
> > > > Hi,
> > > > currently when using non-ascii input, it seems that Lift tries to
> > replace
> > > > as many characters as possible with their html entity. E.g. an input ä
> > will
> > > > generate &auml; in the output. The same seems to be true for more
> > esoteric
> > > > entities as well. On the other hand, if there is no entity available,
> > the
> > > > character will be left untouched as utf-8. (You can easily find out by
> > > > experimenting with the chat on the lift demo site.)
>
> > > > Is it possible that Lift does not make any conversion at all? It’s not
> > > > necessary in a properly utf-8’ed document anyway.
>
> > > > Cheers,
> > > > /rike
>
> > > >  --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Lift" group.
> > > > To post to this group, send email to lif...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com >
> > <liftweb%2Bunsu...@googlegroups.com<liftweb%252Bunsubscribe@googlegroup s.com>>
Reply all
Reply to author
Forward
0 new messages