]> source.dussan.org Git - nextcloud-server.git/commitdiff
Text editor: Always use UTF-8 to keep Ace happy.
authorTom Needham <needham.thomas@gmail.com>
Mon, 2 Jul 2012 19:06:40 +0000 (19:06 +0000)
committerTom Needham <needham.thomas@gmail.com>
Mon, 2 Jul 2012 19:06:40 +0000 (19:06 +0000)
apps/files_texteditor/ajax/loadfile.php
apps/files_texteditor/ajax/savefile.php

index c263306e71917b5805795f8d62ac7e44746e318f..5a5affa46be68371d979d3f5c8c8a1172b031e0b 100644 (file)
@@ -43,6 +43,7 @@ if(!empty($filename))
        {
                $mtime = OC_Filesystem::filemtime($path);
                $filecontents = OC_Filesystem::file_get_contents($path);
+               $filecontents = iconv(mb_detect_encoding($filecontents), "UTF-8", $filecontents);
                OCP\JSON::success(array('data' => array('filecontents' => $filecontents, 'write' => 'false', 'mtime' => $mtime)));      
        }       
 } else {
index f789112d7d7b438450aafe6ec99a2ad2c6e2ccba..961db7105e3371dd7da4036a94cc12dae1e6940f 100644 (file)
@@ -48,6 +48,7 @@ if($path != '' && $mtime != '' && $filecontents)
                // Save file
                if(OC_Filesystem::is_writable($path))
                {
+                       $filecontents = iconv(mb_detect_encoding($filecontents), "UTF-8", $filecontents);
                        OC_Filesystem::file_put_contents($path, $filecontents);
                        // Clear statcache
                        clearstatcache();