Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005586 [Quercus] minor always 11-12-13 13:44 11-12-13 13:44
Reporter JFM View Status public  
Assigned To
Priority normal Resolution open Platform
Status new   OS
Projection none   OS Version
ETA none Fixed in Version Product Version 4.0.36
  Product Build
Summary 0005586: DomDocument UTF-8 Encoding problem
Description
Quercus War 4.0.37
java version "1.7.0_40"
Steps To Reproduce
Additional Information import java.io.IOException;

import javax.script.ScriptEngine;
import javax.script.ScriptException;

import org.w3c.dom.Document;
import org.w3c.dom.ProcessingInstruction;
import org.xml.sax.SAXException;

import com.caucho.quercus.QuercusEngine;
import com.caucho.xml.AbstractParser;
import com.caucho.xml.Xml;

public class QuercusTest {

    private static ScriptEngine engine;

    public static void main(String[] args) throws ScriptException, IOException {
        
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>

&0000937; é

";
                  
         Document doc;
        try {
            doc = new Xml().parseDocumentString(xml);
             System.out.println(doc.getTextContent());
        } catch (SAXException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
        
        
        
        QuercusEngine engine = new QuercusEngine();
        
        //NOTE: add WEB-INF/classes/META-INF/services/com.caucho.quercus.QuercusModule to classpath
        engine.getQuercus().init();
        engine.execute("<?php "

                + "$dom = new DOMDocument();"
                + "$dom->loadXML('<?xml version=\"1.0\" encoding=\"UTF-8\"?>

&0000937;

');"
                + "output($dom);"

                + "$dom->loadXML('

&0000937;

');"
                + "output($dom);"

                + "$dom->loadXML('

&0000937; é

');"
                + "$dom->encoding = \"UTF-8\";"
                + "output($dom);"

                + "$dom = new DOMDocument();"
                + "$dom->appendChild($dom->createTextNode('&0000937;'));"
                + "output($dom);"

                + "$dom = new DOMDocument('1.0', 'UTF-8');"
                + "$dom->appendChild($dom->createTextNode('&0000937;'));"
                + "output($dom);"

                + "$dom = new DOMDocument('1.0', 'ISO-8859-1');"
                + "$dom->appendChild($dom->createTextNode('&0000937;'));"
                + "output($dom);"

                + "$dom = new DOMDocument('1.0', 'ISO-8859-1');"
                + "$dom->loadXML('<?xml version=\"1.0\" encoding=\"UTF-8\"?>

&0000937;

');"
                + "output($dom);"

                + "function output($dom){"
                + " print 'encoding: ' . $dom->encoding . \"\n\";"
                + " print $dom->saveXML() . \"\n\";"
                + "}" );
        
        /*
        engine.execute("<?php "
                + "$xml = new DOMDocument;"
                + "$xml->load($file);"
                + "$xsl = new DOMDocument;"
                + "$xsl->load($xslfile);"
                + "$proc = new XSLTProcessor;"
                + "$proc->importStyleSheet($xsl); "
                + "echo $proc->transformToXML($xml);" );
                */

    }

}
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
11-12-13 13:44 JFM New Issue


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
27 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker