CodiadでSJIS-win対応

Web IDECodiadsjisを扱いたかったので、その時の対応履歴。
保存するときはsjisにして、処理するときはutf-8に戻す。
php文字コード判定がうまくいかないので、ワイルドに修正してます。
config.phpに下記を追加。
define("FILE_ENCODE", "SJIS-win");

class.filemanger.phpをいじる。

diff --git a/components/filemanager/class.filemanager.php b/components/filemanager/class.filemanager.php
index 9ab2c95..6e4e30d 100755
--- a/components/filemanager/class.filemanager.php
+++ b/components/filemanager/class.filemanager.php
@@ -239,8 +239,10 @@ class Filemanager extends Common
                 $this->path = WORKSPACE;
             }
             $input = str_replace('"', '', $this->search_string);
+            $input = str_replace("'", '', $input);
             $input = preg_quote($input);
-            $output = shell_exec('find -L ' . $this->path . ' -iregex  ".*' . $this->search_file_type  . '" -type f | xargs grep -i -I -n -R -H "' . $input . '"');
+            $file_type = str_replace("'", '', $this->search_file_type);
+            $output = shell_exec('find -L ' . $this->path . ' -iregex  ".*' . $file_type  . '" -type f | xargs grep -i -I -n -R -H "' . $input . '"');
             $output_arr = explode("\n", $output);
             $return = array();
             foreach ($output_arr as $line) {
@@ -272,18 +274,8 @@ class Filemanager extends Common
     public function open()
     {
         if (is_file($this->path)) {
-            $output = file_get_contents($this->path);
-            
-            if (extension_loaded('mbstring')) {
-                if (!mb_check_encoding($output, 'UTF-8')) {
-                    if (mb_check_encoding($output, 'ISO-8859-1')) {
-                        $output = utf8_encode($output);
-                    } else {
-                        $output = mb_convert_encoding($content, 'UTF-8');
-                    }
-                }
-            }
-        
+            $output = mb_convert_encoding(file_get_contents($this->path), 'UTF-8', FILE_ENCODE);
+           
             $this->status = "success";
             $this->data = '"content":' . json_encode($output);
             $mtime = filemtime($this->path);
@@ -323,7 +315,7 @@ class Filemanager extends Common
                 if ($file = fopen($this->path, 'w')) {
                     // Write content
                     if ($this->content) {
-                        fwrite($file, $this->content);
+                        fwrite($file, mb_convert_encoding($this->content, FILE_ENCODE, 'UTF-8'));
                     }
                     $this->data = '"mtime":'.filemtime($this->path);
                     fclose($file);
@@ -434,8 +426,7 @@ class Filemanager extends Common
                 }
                 if (is_file($this->path)) {
                     $serverMTime = filemtime($this->path);
-                    $fileContents = file_get_contents($this->path);
-    
+                    $fileContents = mb_convert_encoding(file_get_contents($this->path), 'UTF-8', FILE_ENCODE);
                     if ($this->patch && $this->mtime != $serverMTime) {
                         $this->status = "error";
                         $this->message = "Client is out of sync";
@@ -458,8 +449,7 @@ class Filemanager extends Common
                             //DEBUG : file_put_contents($this->path.".orig",$fileContents );
                             //DEBUG : file_put_contents($this->path.".patch", $this->patch);
                         }
-    
-                        if (fwrite($file, $this->content) === false) {
+                        if (fwrite($file, mb_convert_encoding($this->content, FILE_ENCODE,'UTF-8')) === false) {
                             $this->status = "error";
                             $this->message = "could not write to file";
                         } else {

入れてみたプラグイン

Codiad-Bookmarks-master     Codiad-Collaborative-master  Codiad-Outline-master
Codiad-CodeSettings-master  Codiad-FileUse-master        Codiad-ToDo-master 
Codiad-CompletePlus-master