diff --git a/config.php b/config.php index e77908b..505cb35 100755 --- a/config.php +++ b/config.php @@ -4495,6 +4495,21 @@ class ToolBox return $asResult; } + + public static function utf8_compliant($sText) + { + if(strlen($sText) == 0) return true; + return (preg_match('/^.{1}/us', $sText, $ar) == 1); + } + + /** + * Only works with ISO-8859-1 and UTF-8 encoding + */ + public static function strlen($sText) + { + if(utf8_compliant($sText)) return strlen(utf8_decode($sText)); + else return strlen($sText); + } } /* Debug */ diff --git a/index.php b/index.php index 27c5cfb..f5b91c4 100644 --- a/index.php +++ b/index.php @@ -168,6 +168,35 @@ if($bUserOk && $sAction!=Databap::EXT_ACCESS) $oMySqlInstall = new MySqlManager(); $sResult = $oMySqlInstall->getFullInstallQuery(); break; + case 'fix_encoding': + /** + * Procedure (from ISO-8859-1, aka Latin-1) + * - Rss.php : switch ISO <-> UTF : $sFeed = ''; + * - .htaccess : ajout UTF-8 par défaut : AddDefaultCharset UTF-8 (+check syntax) + * - config.php : Ajouter dans le constructor de Databap : + * - ini_set('default_charset', 'UTF-8'); + * - header('Content-Type: text/html; charset=utf-8'); + * - config.php : changer tous les ISO en UTF : + * - --> + * - config.php : Enlever la conversion en UTF8 de jsonExport() + * - config.php : Ajouter $this->oConnection->set_charset('utf8'); dans le constructeur de MySqlManager + * - replace strlen with ToolBox::strlen() --> check the so called mb_* functions + * - Re-encode all tables from database using utf8_encode() + * - Replace all