Skip to content
Snippets Groups Projects
Commit 88cbbc86 authored by Tom Needham's avatar Tom Needham
Browse files

Text editor: Always use UTF-8 to keep Ace happy.

parent 0a6f7b33
No related branches found
No related tags found
No related merge requests found
......@@ -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 {
......
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment