Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005328 [Quercus] minor always 01-10-13 02:58 01-11-13 14:48
Reporter ngoc View Status public  
Assigned To nam
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.34 Product Version
  Product Build
Summary 0005328: Scripting utf-8 output vietnamese incorrect
Description this bug is reported at : http://bugs.caucho.com/view.php?id=5308 [^]
but status is fixed , but i can't output correct vietnamese character (UTF-8)

Steps To Reproduce
Additional Information Quercus quercus = new Quercus();
          quercus.setUnicodeSemantics(true);
          quercus.setIni("unicode.semantics", "on");
          quercus.init();
          quercus.start();
          QuercusScriptEngine engine = new QuercusScriptEngine(new QuercusScriptEngineFactory(), quercus);
          String sayHelloVN = "<h1>Xin chào chó &0000273;&7891;</h1>";
        
        try {
            System.out.println(sayHelloVN);
            engine.eval( sayHelloVN);
                    
        } catch (Exception e) {
        
            e.printStackTrace();
        }
Attached Files

- Relationships

- Notes
(0006151)
ngoc
01-10-13 03:03

oop !!! sample code not display correct .
see at
http://pastebin.com/eknPAyuy [^]
 
(0006156)
nam
01-11-13 14:48

php/2127
php/2128

Fixed for 4.0.34. To verify, please use subversion to check out our sources.

The following are now set by default: unicode.semantics=on and scriptEncoding=utf8. And QuercusScriptEngine returns Quercus value types now (return type of eval() is Value).

import java.io.*;
import javax.script.*;

import com.caucho.quercus.env.*;
import com.caucho.quercus.script.*;

public class Test
{
  public static void main(String[] args)
    throws Exception
  {
    boolean isUnicodeSemantics = true;

    QuercusScriptEngine phpEngine
      = new QuercusScriptEngine(isUnicodeSemantics);

    StringWriter writer = new StringWriter();
    ScriptContext context = phpEngine.getContext();
    context.setWriter(writer);

    String a0 = "ä";
    String a1 = "\u00e4";
    String code = "<?php print '" + a1 + "'; return '" + a1 + "'; ?>&
quot;;

    Object obj = phpEngine.eval(code);
    String returnValue = obj.toString();
      
    System.out.println("a0_umlaut : " + a0 + ",length=" + a0.length() + ",h
ex(0)=" + Integer.toHexString(a0.charAt(0)));
    System.out.println("a1_umlaut : " + a1 + ",length=" + a1.length() + ",h
ex(0)=" + Integer.toHexString(a1.charAt(0)));

    System.out.println("code      : " + code);
    System.out.println("return    : " + returnValue + ",length=" + returnValue.l
ength() + ",hex(0)=" + Integer.toHexString(returnValue.charAt(0)));

    String output = writer.getBuffer().toString();
    System.out.println("output    : " + output + ",length=" + output.length() + 
",hex(0)=" + Integer.toHexString(output.charAt(0)));
  }
}
 

- Issue History
Date Modified Username Field Change
01-10-13 02:58 ngoc New Issue
01-10-13 02:59 ngoc Issue Monitored: ngoc
01-10-13 03:03 ngoc Note Added: 0006151
01-11-13 14:48 nam Status new => assigned
01-11-13 14:48 nam Assigned To  => nam
01-11-13 14:48 nam Status assigned => closed
01-11-13 14:48 nam Note Added: 0006156
01-11-13 14:48 nam Resolution open => fixed
01-11-13 14:48 nam Fixed in Version  => 4.0.34


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