From: <Ex...@us...> - 2012-03-22 03:15:16
|
Revision: 5123 http://web-erp.svn.sourceforge.net/web-erp/?rev=5123&view=rev Author: ExsonQu Date: 2012-03-22 03:15:10 +0000 (Thu, 22 Mar 2012) Log Message: ----------- 22/3/2012 Exson: Fixed period displayed incorrectly in GL inquiry in Win OS since the strftime() encoding is not UTF-8. Reported by CQZ and KE in webERP Chinese Community QQ group. Modified Paths: -------------- trunk/includes/DateFunctions.inc Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2012-03-21 10:44:31 UTC (rev 5122) +++ trunk/includes/DateFunctions.inc 2012-03-22 03:15:10 UTC (rev 5123) @@ -94,9 +94,18 @@ if (mb_strlen($Date_Array[2])>4) { $Date_Array[2]= mb_substr($Date_Array[2],0,2); } - - return ucfirst(strftime('%B %Y', mktime(0,0,0, (int)$Date_Array[1],(int)$Date_Array[2],(int)$Date_Array[0]))); - + $str = strftime('%B %Y', mktime(0,0,0, (int)$Date_Array[1],(int)$Date_Array[2],(int)$Date_Array[0])); + //This code to handle characters in windows system which not encoded in UTF-8. Those non-utf8 code leads to display garbage + $encode = mb_detect_encoding($str,'GB2312,BIG5,UTF-8'); + + if($encode=='EUC-CN'){ + return iconv('GB2312','UTF-8',$str); + }elseif($encode=='EUC-TW'){ + return iconv('BIG5','UTF-8', $str); + }else{ + return ucfirst($str); + } + } function DayOfWeekFromSQLDate($DateEntry) { @@ -951,4 +960,4 @@ } -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |