From 74c7796396c77cc61efe7be5bd9d3b840b5ca124 Mon Sep 17 00:00:00 2001 From: Fil <fil@rezo.net> Date: Sat, 18 Feb 2006 17:42:03 +0000 Subject: [PATCH] =?UTF-8?q?contourner=20le=20bug=20windows=20sur=20is=5Fut?= =?UTF-8?q?f8=20(et=20is=5Fascii,=20a=20priori,=20qui=20devrait=20avoir=20?= =?UTF-8?q?le=20m=C3=AAme=20souci)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecrire/inc_charsets.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ecrire/inc_charsets.php b/ecrire/inc_charsets.php index e07ced7d01..9813e8c6b0 100644 --- a/ecrire/inc_charsets.php +++ b/ecrire/inc_charsets.php @@ -508,7 +508,7 @@ function bom_utf8($texte) { // http://w3.org/International/questions/qa-forms-utf-8.html function is_utf8($string) { return preg_match(',^(?:' - . '[\x09\x0A\x0D\x20-\x7E]' # ASCII + . '[\x20-\x7E]' # ASCII . '|[\xC2-\xDF][\x80-\xBF]' # non-overlong 2-byte . '|\xE0[\xA0-\xBF][\x80-\xBF]' # excluding overlongs . '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}' # straight 3-byte @@ -516,10 +516,14 @@ function is_utf8($string) { . '|\xF0[\x90-\xBF][\x80-\xBF]{2}' # planes 1-3 . '|[\xF1-\xF3][\x80-\xBF]{3}' # planes 4-15 . '|\xF4[\x80-\x8F][\x80-\xBF]{2}' # plane 16 - . ')*$,s', $string); + . ')*$,s', + strtr($string, "\t\r\n", " ") # contourner bug windows sur \r + ); } function is_ascii($string) { - return preg_match(',^[\x09\x0A\x0D\x20-\x7E]*$,s', $string); + return preg_match(',^[\x20-\x7E]*$,s', + strtr($string, "\t\r\n", " ") + ); } // Transcode une page (attrapee sur le web, ou un squelette) en essayant -- GitLab