#46335 [Opn->Bgs]: DOMText::splitText doesn't handle multibyte characters
| From: | tularis@php.net | Date: | Fri, 17 Oct 2008 18:19:00 +0000 |
| Subject: | #46335 [Opn->Bgs]: DOMText::splitText doesn't handle multibyte characters | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-129812@lists.php.net to get a copy of this message | ||
ID: 46335
Updated by: tularis@php.net
Reported By: sites at hubmed dot org
-Status: Open
+Status: Bogus
Bug Type: DOM XML related
Operating System: OS X
PHP Version: 5.2.6
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
in PHP < 6, this is expected behaviour. PHP < 6 just isn't
unicode-aware by default. It should work in PHP 6 however. If not, let
us know.
Previous Comments:
------------------------------------------------------------------------
[2008-10-17 17:10:20] sites at hubmed dot org
Description:
------------
Using the DOMText function splitText() on a text node containing
multibyte characters results in the node being split at the wrong
position.
Reproduce code:
---------------
$text = 'This is an example of using DOM splitText';
$start = 30;
$length = 3;
$dom = new DOMDocument('1.0', 'UTF-8');
$node = $dom->createTextNode($text);
$dom->appendChild($node);
print "Text: $node->textContent\n";
print 'Expected (mb_substr): ' . mb_substr($text, $start, $length,
'UTF-8') . "\n";
$matched = $node->splitText($start);
$matched->splitText($length);
print "Actual (splitText): $matched->textContent\n";
Expected result:
----------------
Text: This is an example of using DOM splitText
Expected (mb_substr): DOM
Actual (splitText): DOM
Actual result:
--------------
Text: This is an example of using DOM splitText
Expected (mb_substr): DOM
Actual (splitText): ing
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46335&edit=1