From 42c60a820afd4e008b7c9cd4606ca543bedbbb00 Mon Sep 17 00:00:00 2001 From: Kirill Krasnov Date: Tue, 23 Jun 2009 06:52:17 +0300 Subject: [PATCH] UTF8 wrapper for unicode filename in getting extension --- core/file_api.php | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/file_api.php b/core/file_api.php index 4ad5c5f..69de9fa 100644 --- a/core/file_api.php +++ b/core/file_api.php @@ -842,17 +842,17 @@ function file_get_extension( $p_filename ) { $dot_found = false; $i = utf8_strlen( $p_filename ) - 1; while( $i >= 0 ) { - if( '.' == $p_filename[$i] ) { + if( '.' == utf8_substr($p_filename,$i,1) ) { $dot_found = true; break; } # found a directory marker before a period. - if(( $p_filename[$i] == "/" ) || ( $p_filename[$i] == "\\" ) ) { + if(( utf8_substr($p_filename,$i,1) == "/" ) || ( utf8_substr($p_filename,$i,1) == "\\" ) ) { return ''; } - $ext = $p_filename[$i] . $ext; + $ext = utf8_substr($p_filename,$i,1) . $ext; $i--; } -- 1.6.3.2.1299.gee46c