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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Fri Dec 04 03:01:23 2020 UTC