Hi Moriyoshi,

To generate a valid xml document I only need to escape five characters 
inside any content: &<>"'

So what I really need is "htmlspecialchars", not "htmlentities". 
And besides the unnecessary translation of many characters, by doing so 
"htmlentities" produces an invalid xml document...
--
Renato

On 5 Dec 2002 at 4:22, Moriyoshi Koizumi wrote:

> Hi,
> 
> If you want to do the full entity translation, use htmlentities() instead 
> of htmlspecialchars()
> 
> http://www.php.net/htmlspecialchars
> 
> Moriyoshi
> 
> "Renato De Giovanni" wrote:
> 
> > Hi,
> > 
> > We're working on a program that needs to generate an xml document, utf-8 
> > encoded, based on information stored with another charset encoding inside a 
> > database.
> > 
> > So basically at some point we have a function that looks like:
> > 
> > function encodeString($s, $encoding)
> > {
> >   $s = mb_convert_encoding($s, 'UTF-8', $encoding);
> > 
> >   $s = htmlspecialchars($s, ENT_COMPAT, 'UTF-8');
> > 
> >   return $s;
> > }
> > 
> > What happens is that "htmlspecialchars" seems to be always returning a 
> > latin1 string, therefore causing problems with the generated document 
> > supposedly utf-8 encoded.
> > 
> > My question is: is this a php bug or am I misunderstanding something related 
> > to multi-byte character support?
> > 
> > PHP version is 4.2.3
> > 
> > Thank you very much!
> > --
> > Renato
> > CRIA - Centro de Referencia em Informacao Ambiental
> > http://www.cria.org.br/

--
This message has been scanned for viruses and
dangerous content and is believed to be clean.


-- 
PHP Internationalization Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to