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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 + 34 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 15:01:28 2024 UTC