Browse Source

[svn r15319] deal with quotes in slidenames (FS#2477)

Eric Marguin 17 years ago
parent
commit
727db404a6
1 changed files with 7 additions and 1 deletions
  1. 7 1
      main/newscorm/openoffice_presentation.class.php

+ 7 - 1
main/newscorm/openoffice_presentation.class.php

@@ -37,7 +37,13 @@ class OpenofficePresentation extends OpenofficeDocument {
 		foreach($files as $file){
 			
 			list($slide_name,$file_name) = explode('||',$file); // '||' is used as separator between slide name (with accents) and file name (without accents)
-			$slide_name = utf8_decode($slide_name); //filename has been written in java, so unicode
+			
+			//filename is utf8 encoded, but when we decode, some chars are not translated (like quote ’).
+			//so we remove these chars by translating it in htmlentities and the reconvert it in want charset
+			$slide_name = htmlentities($slide_name,ENT_COMPAT,'utf-8'); 
+			$slide_name = str_replace('’','\'',$slide_name);
+			$slide_name = mb_convert_encoding($slide_name, api_get_setting('platform_charset'), 'utf-8');
+			$slide_name = html_entity_decode($slide_name);
 			
 			if($this->take_slide_name === true)
 			{