Hello all,
I installed php83 on MacOS Sonoma 14.5 (M1 Mac),
but for some reason, it was unable to correctly process
XML containing multi-byte characters (UTF-8). It was
previously handled correctly.

Do I need to install any other extension modules?

The execution result of test.php is as follows:
(I have attached "test.php" to this email.)
-----------------------------------------------------
$ /opt/local/bin/php83 --version
PHP 8.3.12 (cli) (built: Oct 13 2024 07:48:54) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.12, Copyright (c) Zend Technologies
$ /opt/local/bin/php83 test.php
(1) ASCII
doc: text1
(2) UTF-8

Warning: DOMXPath::query(): Invalid expression in
/private/tmp/test.php on line 20
-----------------------------------------------------

The output I expect is:
-----------------------------------------------------
$ /opt/local/bin/php83 test.php
(1) ASCII
doc: text1
(2) UTF-8
文書: text1
-----------------------------------------------------

Thanks,
Shigio
-- 
Shigio YAMAGUCHI <shi...@gnu.org>
PGP fingerprint:
26F6 31B4 3D62 4A92 7E6F  1C33 969C 3BE3 89DD A6EB
<?php
function show($result) {
	if ($result == false)
		return;
	foreach ($result as $node) {
		echo $node->nodeName . ": " . $node->nodeValue . "\n";
	}
}
$dom = new DOMDocument();

echo "(1) ASCII\n";
$dom->loadXML("<doc>text1</doc>");
$xpath = new DOMXPath($dom);
$result = $xpath->query("/doc");
show($result);

echo "(2) UTF-8\n";
$dom->loadXML("<文書>text1</文書>");
$xpath = new DOMXPath($dom);
$result = $xpath->query("/文書");
show($result);
?>

Reply via email to