diff --git a/main/newscorm/openoffice_document.class.php b/main/newscorm/openoffice_document.class.php index 91fe223f09..42097fda0e 100644 --- a/main/newscorm/openoffice_document.class.php +++ b/main/newscorm/openoffice_document.class.php @@ -15,6 +15,8 @@ abstract class OpenofficeDocument extends learnpath { public $first_item = 0; + public $original_charset = 'utf-8'; + public $original_locale = 'en_US.UTF-8'; /** * Class constructor. Based on the parent constructor. @@ -82,7 +84,7 @@ abstract class OpenofficeDocument extends learnpath { chmod ($this->base_work_dir.$this->created_dir,0777); chmod ($this->base_work_dir.'/'.$this->file_path,0777); - $locale = 'en_US.UTF-8'; // TODO : improve it because we're not sure this locale is present everywhere + $locale = $this->original_locale; // TODO : improve it because we're not sure this locale is present everywhere putenv('LC_ALL='.$locale); $shell = exec($cmd, $files, $return); if($return != 0) { //if the java application returns an error code diff --git a/main/newscorm/openoffice_presentation.class.php b/main/newscorm/openoffice_presentation.class.php index 03b030d29e..dffad7565e 100644 --- a/main/newscorm/openoffice_presentation.class.php +++ b/main/newscorm/openoffice_presentation.class.php @@ -42,9 +42,9 @@ class OpenofficePresentation extends OpenofficeDocument { //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 = htmlentities($slide_name,ENT_COMPAT,$this->original_charset); $slide_name = str_replace('’','\'',$slide_name); - $slide_name = mb_convert_encoding($slide_name, api_get_setting('platform_charset'), 'utf-8'); + $slide_name = mb_convert_encoding($slide_name, api_get_setting('platform_charset'), $this->original_charset); $slide_name = html_entity_decode($slide_name); if($this->take_slide_name === true) @@ -112,9 +112,9 @@ 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 = htmlentities($slide_name,ENT_COMPAT,'utf-8'); + $slide_name = htmlentities($slide_name,ENT_COMPAT,$this->original_charset); $slide_name = str_replace('’','\'',$slide_name); - $slide_name = mb_convert_encoding($slide_name, api_get_setting('platform_charset'), 'utf-8'); + $slide_name = mb_convert_encoding($slide_name, api_get_setting('platform_charset'), $this->original_charset); $slide_name = html_entity_decode($slide_name); $did = add_document($_course, $this->created_dir.'/'.urlencode($file_name), 'file', filesize($this->base_work_dir.$this->created_dir.'/'.$file_name), $slide_name); diff --git a/main/newscorm/openoffice_text_document.class.php b/main/newscorm/openoffice_text_document.class.php index 23075c2eea..98a8aeae43 100644 --- a/main/newscorm/openoffice_text_document.class.php +++ b/main/newscorm/openoffice_text_document.class.php @@ -53,10 +53,10 @@ class OpenOfficeTextDocument extends OpenofficeDocument { // the file is utf8 encoded and it seems to make problems with special quotes. // then we htmlentities that, we replace these quotes and html_entity_decode that in good charset $charset = api_get_setting('platform_charset'); - $content = htmlentities($content,ENT_COMPAT,'utf-8'); + $content = htmlentities($content,ENT_COMPAT,$this->original_charset); $content = str_replace('’','\'',$content); - $content = mb_convert_encoding($content, $charset, 'utf-8'); - $content = str_replace('utf-8',$charset,$content); + $content = mb_convert_encoding($content, $charset, $this->original_charset); + $content = str_replace($this->original_charset,$charset,$content); $content = html_entity_decode($content); // set the path to pictures to absolute (so that it can be modified in fckeditor)