浏览代码

- Fixed bug Trac #65: incorrect display of non-ASCII characters. htmlentities must be aware of the charset used !

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@217 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 15 年之前
父节点
当前提交
a06818fe9e
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      core/MyHelpers.class.inc.php

+ 3 - 2
core/MyHelpers.class.inc.php

@@ -434,9 +434,10 @@ class Str
 	}
 	}
 	public static function pure2html($pure, $maxLength = false)
 	public static function pure2html($pure, $maxLength = false)
 	{
 	{
+		// Check for HTML entities, but be careful the DB is in UTF-8
 		return $maxLength
 		return $maxLength
-			? htmlentities(substr($pure, 0, $maxLength))
-			: htmlentities($pure);
+			? htmlentities(substr($pure, 0, $maxLength), ENT_COMPAT, 'UTF-8')
+			: htmlentities($pure, ENT_COMPAT, 'UTF-8');
 	}
 	}
 	public static function pure2sql($pure, $maxLength = false)
 	public static function pure2sql($pure, $maxLength = false)
 	{
 	{