php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31909 can't support gb2312 charset
Submitted: 2005-02-10 03:53 UTC Modified: 2005-02-10 09:51 UTC
From: misnet at hotmail dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.0.3 OS: windows server 2003
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: misnet at hotmail dot com
New email:
PHP Version: OS:

 

 [2005-02-10 03:53 UTC] misnet at hotmail dot com
Description:
------------
$dom = new DOMDocument("1.0","gb2312");
$rootElement = $dom->createElement("Article");
$rootElement->appendChild($dom->createElement("Title",$title);
echo $dom->saveXML();
------------------
Run result is wrong!
If "$title" is utf-8 code, it can be right! 
In the DOMDocument construction, I use gb2312 charset,the $title should be gb2312 code.But in the fact, I have to use utf-8,otherwise it will be wrong!
why? 



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-10 09:51 UTC] chregu@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Input always has to be utf-8, for example for createElement() (only exceptions are load() and loadXML()). You have to convert that to UTF-8 before putting it into dom.

The second parameter of the constructor is for the output encoding.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 21:01:27 2025 UTC