View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update | 
|---|---|---|---|---|---|
| 0010611 | mantisbt | localization | public | 2009-06-22 03:30 | 2009-06-23 15:26 | 
| Reporter | Kirill | Assigned To | dhx | ||
| Priority | normal | Severity | minor | Reproducibility | have not tried | 
| Status | closed | Resolution | fixed | ||
| Product Version | git trunk | ||||
| Target Version | 1.2.0rc1 | Fixed in Version | 1.2.0rc1 | ||
| Summary | 0010611: Attach not recognize correctly | ||||
| Description | I upload Word, Image files, but they show as Plain Text. | ||||
| Tags | No tags attached. | ||||
| Attached Files |  Issue10611.patch (1,072 bytes)   
 From 42c60a820afd4e008b7c9cd4606ca543bedbbb00 Mon Sep 17 00:00:00 2001
From: Kirill Krasnov <krasnovforum@gmail.com>
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
 | ||||
| MantisBT: master 735dbd5c 2009-06-23 05:38 Details Diff | Fix 0010611: file extension check fails with UTF-8 Rewrite file_get_extension to work with UTF-8 file names and file extensions. Also make file_check_type use file_get_extension instead of using it's own extraction method. Thanks Kirill for reporting this bug! | Affected Issues 0010611 | |
| mod - core/file_api.php | Diff File | ||
