ID:               29609
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jon at hiveminds dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Strings related
 Operating System: Windows 2000 / SP4
 PHP Version:      5.0.0
 New Comment:

This charset is not supported, as you can see here:
http://php.net/htmlentities


Previous Comments:
------------------------------------------------------------------------

[2004-08-11 11:40:58] jon at hiveminds dot net

Description:
------------
This string function fails on the "š" character (and other Latin-2
characters).

Test:

echo htmlentities("Ketšua");

Returns: Ketšua

Reproduce code:
---------------
Affected code:

$value = htmlentities($value);

preg_match_all("/&([^;]*);/", $value, $matches);
$parts = preg_split("/&|;/", $value, -1, PREG_SPLIT_NO_EMPTY);

foreach($parts as $part)
 $td->appendChild(
                    in_array($part, $matches[1])
                    ? $doc->createEntityReference($part)
                    : $doc->createTextNode($part)
                  );

Point of failure: the string "Ketšua"

Expected result:
----------------
Character should be converted to Š (upper) / š (lower)
per HTML spec (see special-1.ent listing).

Failing this, should it not be possible to create a TextNode containing
this character when specifying a Latin-2 or Unicode charset?

Actual result:
--------------
Function returns the literal "š" character with no conversion.

It is not possible to create a TextNode containing this character using
DOMDocument::createTextNode().

I have written a workaround which replaces the Lat-2 chars with their
entity equivalents using str_replace(), but even so PHP still issues
several warnings when sending output to the browser using
DOMDocument::saveHTML():

Warning: output conversion failed due to conv error in
O:\webs\mysqli\oop-multi-select-with-dom.php on line 172

Warning: Bytes: 0x92 0x49 0x76 0x6F in
O:\webs\mysqli\oop-multi-select-with-dom.php on line 172

Warning: xmlOutputBufferWrite: encoder error in
O:\webs\mysqli\oop-multi-select-with-dom.php on line 172

The correct entity (š) does get sent, but I have to suppress the
error with an "@", which I don't like doing.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29609&edit=1

Reply via email to