ID:               32547
 Updated by:       [EMAIL PROTECTED]
 Reported By:      xlex0x835 at rambler dot ru
-Status:           Closed
+Status:           Bogus
 Bug Type:         DOM XML related
 Operating System: Mac OS X 10.3, FreeBSD 5.3
 PHP Version:      5.0.3
 Assigned To:      rrichards
 New Comment:

No PHP bug -> bogus.


Previous Comments:
------------------------------------------------------------------------

[2005-04-04 09:09:40] xlex0x835 at rambler dot ru

As for <xml>, please, read more carefully. I told, that 
I put that tag just to have one correct source for both 
loadHTML() and loadXML() methods.

As for libxml - thank you to confirm that it is that lib 
problem.

------------------------------------------------------------------------

[2005-04-04 08:40:10] [EMAIL PROTECTED]

Not a bug, IMHO. HTML 4 is not XML, therefore it doesn't know about the
<?xml ?> processing instruction and doesn't apply that information. You
have to use the meta tag in html 4 (loadHTML is only about HTML 4 and
not XHTML)

I may be wrong with that assumption, so please point me to the right
specs, if loadHTML should recognize that.

But anyway, not a PHP bug, but basically a libxml2 "problem"



------------------------------------------------------------------------

[2005-04-03 19:44:05] xlex0x835 at rambler dot ru

Problem seems to be detected: if I will put <meta> tag 
just after the title, document will be parsed absolutely 
correct.
Is it libxml bug or PHP bindings?

------------------------------------------------------------------------

[2005-04-02 18:58:50] xlex0x835 at rambler dot ru

Description:
------------
If I use DOMDocument->loadHTML() method with an utf-8 
HTML, which contains russian characters, that russian 
characters just messed (please see 'Actual result').

Nothing changed if I specify encoding "by hand" (I mean 
the following call: "$domDoc = new DOMDocument('1.0', 
'utf-8');").

But, eveything works just fine if I use DOMDocument-
>loadXML() method (that's why there is xml definition 
string in the input).

Nothing changed if I will remove all $domDoc options, 
neither removing "<?xml ... ?>" string (it is actually 
exist only to get one source for both loadHTML() and 
loadXML() functions call - to test error).

The problem was discrovered on the "real-world" HTML, 
the code was stripped to the minimum for the ease of 
use.


Host info.
===================================

[PHP Modules (on FreeBSD 5.3 host)]
bcmath
bz2
calendar
ctype
curl
dom
exif
ftp
gd
gettext
gmp
iconv
imap
libxml
mbstring
mcrypt
mcve
mhash
mysql
ncurses
odbc
openssl
pcntl
pcre
pgsql
posix
pspell
readline
session
shmop
SimpleXML
snmp
soap
sockets
SPL
SQLite
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlrpc
xsl
yaz
yp
zip
zlib

No Zend modules.


FreeBSD 5.3-RELEASE
libxml2-2.6.13
gcc (GCC) 3.4.2 [FreeBSD] 20040728

Reproduce code:
---------------
<?php 

$xmlContent = file_get_contents('input_test'); 

$domDoc = new DOMDocument(); 
$domDoc->formatOutput = true; 
$domDoc->preserveWhiteSpace = false; 
$domDoc->recover = true; 
$domDoc->loadXML($xmlContent); 
�������� 
file_put_contents('output_test', $domDoc->saveXML()); 
?> 



input_test:
===========
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title>���� - Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
</html>

Expected result:
----------------
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 
Transitional//EN" "http://www.w3.org/TR/REC-html40/
loose.dtd">
<html>
  <head>
    <title>���� - Test</title>
    <meta http-equiv="Content-Type" content="text/html; 
charset=utf-8"/>
  </head>
</html>

Actual result:
--------------
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 
Transitional//EN" "http://www.w3.org/TR/REC-html40/
loose.dtd">
<html>
  <head>
    <title>Тест - Test</title>
    <meta http-equiv="Content-Type" content="text/html; 
charset=utf-8"/>
  </head>
</html>


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32547&edit=1

Reply via email to