aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Needham <needham.thomas@gmail.com>2012-07-02 19:06:40 +0000
committerTom Needham <needham.thomas@gmail.com>2012-07-02 19:06:40 +0000
commit88cbbc86b84984946b80f6dd18e5a6a88b47f936 (patch)
tree88942bc939419883e94632f85733ff4f52840526
parent0a6f7b33c3b5e0552c041f3d529f577c0b392f40 (diff)
downloadnextcloud-server-88cbbc86b84984946b80f6dd18e5a6a88b47f936.tar.gz
nextcloud-server-88cbbc86b84984946b80f6dd18e5a6a88b47f936.zip
Text editor: Always use UTF-8 to keep Ace happy.
-rw-r--r--apps/files_texteditor/ajax/loadfile.php1
-rw-r--r--apps/files_texteditor/ajax/savefile.php1
2 files changed, 2 insertions, 0 deletions
diff --git a/apps/files_texteditor/ajax/loadfile.php b/apps/files_texteditor/ajax/loadfile.php
index c263306e719..5a5affa46be 100644
--- a/apps/files_texteditor/ajax/loadfile.php
+++ b/apps/files_texteditor/ajax/loadfile.php
@@ -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 {
diff --git a/apps/files_texteditor/ajax/savefile.php b/apps/files_texteditor/ajax/savefile.php
index f789112d7d7..961db7105e3 100644
--- a/apps/files_texteditor/ajax/savefile.php
+++ b/apps/files_texteditor/ajax/savefile.php
@@ -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();