UTF-8 Encoding
Opened this issue · 0 comments
GoogleCodeExporter commented
What steps will reproduce the problem?
1. Use Spring hessian to export hessian service that is encoded using UTF-8
2. Invoke this service using HessianClient.php will produce error string
message due to the mismatched encoding.
I'm Using the latest 2.2 release.
when i check your source code[Hessian2Parser.php], i find your library do the
following check.
function readUTF8Bytes($len){
if(HessianUtils::isInternalUTF8())
return $string;
return utf8_decode($string);
}
so if the string is already utf8 encoded and the
;mbstring.internal_encoding = UTF-8 in the php.ini is't correct config
or have no permission to the php.ini. the string will decode to ascii
so i add the following code to the method and it's works for me.
function readUTF8Bytes($len){
if(HessianUtils::isInternalUTF8())
return $string;
if(mb_detect_encoding($string) == 'UTF-8')
return $string;
return utf8_decode($string);
}
Hope that it will help.
THANKS FOR YOUR GTREAT LIBRARY!!!
Original issue reported on code.google.com by inspire...@gmail.com
on 26 Nov 2010 at 8:36