mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-07 00:56:48 +01:00
To fix Chinese character display abnormal
When "default_charset" was not set in php.ini,and the file contents chinese char,it may show incorrectly. Because the function htmlentities() takes "ISO-8859-1" as default value of "default_charset" if PHP version is lower than 5.4. So I think it's better to check the "default_charset" before function htmlentities(). What's your opinion?
This commit is contained in:
@@ -103,7 +103,10 @@ if ($_GET['action']=="load") {
|
||||
} else {
|
||||
$loadedFile = toUTF8noBOM(file_get_contents($file,false,$context),true);
|
||||
}
|
||||
echo '</script><textarea name="loadedFile" id="loadedFile">'.htmlentities($loadedFile).'</textarea><script>';
|
||||
$encoding=ini_get("default_charset");
|
||||
if($encoding=="")
|
||||
$encoding="UTF-8";
|
||||
echo '</script><textarea name="loadedFile" id="loadedFile">'.htmlentities($loadedFile,ENT_COMPAT,$encoding).'</textarea><script>';
|
||||
// Run our custom processes
|
||||
include_once("../processes/on-file-load.php");
|
||||
} else if (strpos($finfo,"image")===0) {
|
||||
@@ -218,4 +221,4 @@ if (action=="load") {
|
||||
|
||||
// Finally, switch mode in case we have saved, renamed file etc
|
||||
top.ICEcoder.switchMode();
|
||||
</script>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user