#41484 [NEW]: DOMDocument doesn`t convert character-set automaticly

From: Date: Thu, 24 May 2007 08:54:55 +0000
Subject: #41484 [NEW]: DOMDocument doesn`t convert character-set automaticly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112983@lists.php.net to get a copy of this message
From:             songqi at baidu dot com
Operating system: Redhat linux
PHP version:      5.2.2
PHP Bug Type:     DOM XML related
Bug description:  DOMDocument doesn`t convert character-set automaticly

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

-- 
Edit bug report at http://bugs.php.net/?id=41484&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41484&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41484&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41484&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41484&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=41484&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41484&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41484&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41484&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41484&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41484&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=41484&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=41484&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41484&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41484&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41484&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41484&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41484&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41484&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41484&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41484&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#112983) next »