Tweak to if condition to not convert UTF8

Otherwise we are UTF8 encoding the UTF8 encoding and special chars can
get messed up
This commit is contained in:
Matt Pass
2013-07-10 16:18:59 +01:00
parent 10a91df31c
commit fdc5bc34fd

View File

@@ -72,7 +72,7 @@ function toUTF8noBOM($string,$message) {
$teststringBroken = utf8_decode($teststring);
$teststringConverted = iconv("UTF-8", "UTF-8//IGNORE", $teststringBroken);
// If we have a matching length, UTF8 encode it
if ($encType != "ASCII" && strlen($teststringConverted) == strlen($teststringBroken)) {
if ($encType != "ASCII" && $encType != "UTF-8" && strlen($teststringConverted) == strlen($teststringBroken)) {
$string = utf8_encode($string);
if ($message) {
echo "top.ICEcoder.message('Your document doesn\'t appear to be in UTF-8 encoding so has been converted.');";