| Anonymous | Login | Signup for a new account | 11-01-2025 19:28 PDT |
| Main | My View | View Issues | Change Log | Docs |
| 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 | |||||||||
|
|
|||||||||
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)));
}
}
|
| Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
34 total queries executed. 29 unique queries executed. |