|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-05-24 08:54 UTC] songqi at baidu dot com
Description:
------------
I want to use DOM Functions to generate xml with some gb2312 characters, but DOMDocument doesn`t convert character-set to utf-8 automaticly, and throws a exception 'DOMException' with message 'Invalid Character Error'.
Reproduce code:
---------------
$doc = new DOMDocument("1.0","gb2312");
$doc->createElement("?ؼ???");
echo $doc->saveXML();
Expected result:
----------------
<?xml version="1.0" encoding="gb2312"?>
<?ؼ???/>
Actual result:
--------------
Fatal error: Uncaught exception 'DOMException' with message 'Invalid Character Error' in /home/songq/local/htdocs/test/Auth.php:7 Stack trace: #0 /home/songq/local/htdocs/test/Auth.php(7): DOMDocument->createElement('??????') #1 {main} thrown in /home/songq/local/htdocs/test/Auth.php on line 7
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 19 13:00:01 2025 UTC |
$doc->createElement("") and all other DOM methods (except the ->load..() methods) always expects UTF-8 encoded strings That's how it works. Not a bug.