Suuport UTF8 format

This commit is contained in:
Laurent Destailleur
2008-10-20 22:12:21 +00:00
parent 5758db39d3
commit 91ee242a97
2 changed files with 12 additions and 7 deletions

View File

@@ -456,7 +456,11 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$convtooutput=true)
// Date is a timestamps // Date is a timestamps
$ret=adodb_strftime($format,$time,$to_gmt); $ret=adodb_strftime($format,$time,$to_gmt);
} }
return ($convtooutput?$langs->convToOuptutCharset($ret):$ret);
// Page code for text from strftime functions
$pagecodefrom='ISO-8859-1';
return ($convtooutput?$langs->convToOuptutCharset($ret,$pagecodefrom):$ret);
} }

View File

@@ -425,14 +425,15 @@ class Translate {
/** /**
* \brief Convertit une chaine dans le charset de sortie * \brief Convert a string into output charset (this->charset_output)
* \param str chaine a convertir * \param str chaine a convertir
* \return string chaine traduite * \param pagecodefrom Page code of src string
* \return string chaine traduite
*/ */
function convToOuptutCharset($str) function convToOuptutCharset($str,$pagecodefrom='UTF-8')
{ {
//if ($this->charset_output=='UTF-8') $str=utf8_encode($str); if ($pagecodefrom == 'ISO-8859-1' && $this->charset_output == 'UTF-8') $str=utf8_encode($str);
if ($this->charset_output=='ISO-8859-1') $str=utf8_decode($str); if ($pagecodefrom == 'UTF-8' && $this->charset_output == 'ISO-8859-1') $str=utf8_decode($str);
return $str; return $str;
} }