Re: Text_Wiki: Transforming to XHTML without encoding entities?

From: Date: Fri, 07 Nov 2008 17:13:58 +0000
Subject: Re: Text_Wiki: Transforming to XHTML without encoding entities?
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-51025@lists.php.net to get a copy of this message
You changed setConf and getConf....? I don't see any changes regarding htmlentities or htmlspecialchars here. On Fri, Nov 7, 2008 at 8:02 AM, Charl Mert <charl.mert@gmail.com> wrote: > Thanx for you reply. > > The changes I made will allow you to choose between htmlentities vs > htmlspecialchars by setting the Xhtml conf 'translate' parameter via the > object's getters and setters. > > > You only have to encode things that could be > > interpreted as markup in the current context, since doing > contextsensitive > > encoding is pretty complicated most of the time you just encode <>&"' > > everywhere (htmlspecialchars with ENT_QUOTES). > > I'm going with htmlspecialchars because I don't want all entity > representable characters display as entities. > > It's really a small change that I'd like to commit so that our system stays > on the upgrade path. > > > Here's the change exactly: > > Text/Wiki.php : > ... > ... > function transform($text, $format = 'Xhtml', $encodeEntities = true) > { > $this->parse($text); > return $this->render($format , $encodeEntities); > } > > > Text/Wiki/Render/Xhtml.php > ... > ... > /** > * Method to set a config key > * > * @access public > * @param string $text the text to render > * @return rendered text > * > */ > > function setConf($key, $value) > { > $this->conf[$key] = $value; > } > > /** > * Method to get the value at the specified config key > * > * @access public > * @param string $text the text to render > * @return rendered text > * > */ > > function getConf($key, $default) > { > if (isset($this->conf[$key])) { > return $this->conf[$key]; > } else { > return $default; > } > } > > Best Regards and happy coding. > --Charl > > On Thu, Nov 6, 2008 at 3:48 PM, Stefan Walk <et@php.net> wrote: > > > On Thursday 06 November 2008 14:14:39 Charl Mert wrote: > > > Hi All, > > > > > > I'm using this class to transform Wiki markup to Xhtml in the wiki > module > > > written for Chisimba framework. > > > We ran into some problems with displaying utf-8 chars like "wêreld, > > > reënboognasie Voël". > > > > On a side note, this most often results from using htmlentities() with > the > > wrong encoding (latin1 is assumed if none is passed) > > > > > I've added the option to transform without encoding the htmlentities by > > > playing with the translate config option in Xhtml.php > > > Does Xhtml standards specify htmlentity encoding as a MUST? > > > > No, actually it's quite useless except in the case that you use a > > non-unicode > > character set for your xhtml document and want to use unicode chars that > > are > > not in this character set. You only have to encode things that could be > > interpreted as markup in the current context, since doing > contextsensitive > > encoding is pretty complicated most of the time you just encode <>&"' > > everywhere (htmlspecialchars with ENT_QUOTES). > > > > > I would like to register with pear dev and post these if the changes > are > > > welcome/legal. > > > > You can subscribe at > > https://pear.php.net/support/lists.php - if that's > > what > > you mean by registering. > > > > Best regards, > > Stefan > > > -- Justin Patrin

« previous php.pear.dev (#51025) next »