Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004798 [Resin] minor always 10-12-11 14:50 06-20-12 10:52
Reporter alex View Status public  
Assigned To ferg
Priority normal Resolution unable to reproduce  
Status closed   Product Version
Summary 0004798: Japanese characters: java + php
Description Even if characters set is "UTF-8" in "Quercus" setting and the other environments ,characters in Java String are garbling.

For Example...

Java class :
 1 public class TestClass {
 2
 3 public static String TestString() {
 4 return "&12354;&12356;&12358;&12360;&12362;";
 5 }
 6
 7 public static String toByteString(Object o) {
 8 byte[] b = o.toString().getBytes();
 9 StringBuilder bs = new StringBuilder();
10 String hex;
11 for (int i = 0; i < b.length; i++) {
12 hex = Integer.toHexString(b[i]);
13 bs.append(hex.substring(hex.length() - 2));
14 }
15 return bs.toString();
16 }
17 }
Additional Information PHP
 1 <?php
 2 // Garbling would happen
 3 $testStr = TestClass::TestString();
 4 echo $testStr;
 5 ?>
 6
 7 <hr/>
 8
 9 <?php
10 // Convert Byte String
11 $val = TestClass::toByteString($testStr);
12 echo $val;
13 ?>
14
15 <hr/>
16
17 <?php
18 // pack
19 echo pack("H*", $val);
20 ?>

Result (HTML)
1 BDFHJ
2 <hr/>
3
4 e38182e38184e38186e38188e3818a
5 <hr/>
6
7 &12354;&12356;&12358;&12360;&12362;
So, Line 1 is unexpected characters, we extected "&12354;&12356;&12358;&12360;&12362;".
Attached Files

- Relationships

- Notes
(0005561)
alex
10-12-11 14:52

see attached file for nicely formatted code. Question 6.
 
(0005895)
ferg
06-20-12 10:52

php/0jj2

Note that the important setting is unicode.semantics="1" and also that the provided code is incorrect because it uses String.getBytes(). Either String.getBytes("UTF-8") or converting to hex from the char directly would be preferred.
 

- Issue History
Date Modified Username Field Change
10-12-11 14:50 alex New Issue
10-12-11 14:52 alex Note Added: 0005561
06-20-12 10:52 ferg Note Added: 0005895
06-20-12 10:52 ferg Assigned To  => ferg
06-20-12 10:52 ferg Status new => closed
06-20-12 10:52 ferg Resolution open => unable to reproduce
06-20-12 10:52 ferg Fixed in Version  => 4.0.29


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