htmlspecialchars and UTF-8

From: Date: Wed, 04 Dec 2002 18:37:58 +0000
Subject: htmlspecialchars and UTF-8
Groups: php.i18n 
Request: Send a blank email to php-i18n+get-368@lists.php.net to get a copy of this message
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.

« previous php.i18n (#368) next »