diff --git a/module/git/config.php b/module/git/config.php index 17f481acfd..c5c8b2e310 100644 --- a/module/git/config.php +++ b/module/git/config.php @@ -14,7 +14,7 @@ * */ $config->git = new stdClass(); -$config->git->encodings = 'utf-8, gbk'; +$config->git->encodings = 'utf-8'; $config->git->client = ''; $i = 1; diff --git a/module/git/model.php b/module/git/model.php index 40946297d8..e377f375c2 100644 --- a/module/git/model.php +++ b/module/git/model.php @@ -430,6 +430,10 @@ class gitModel extends model if(count($lists) == 2) list($nowRevision, $preRevision) = $lists; $cmd = "$this->client diff $preRevision $nowRevision -- $subPath"; $diff = `$cmd`; + + $encodings = isset($repo->encodings) ? $repo->encodings : $this->config->svn->encodings; + if($encodings or $encodings != 'utf-8') $diff = helper::convertEncoding($diff, $encodings); + return $diff; } @@ -457,6 +461,10 @@ class gitModel extends model exec("{$this->client} config core.quotepath false"); $cmd = "$this->client show $revision:$subPath"; $code = `$cmd`; + + $encodings = isset($repo->encodings) ? $repo->encodings : $this->config->git->encodings; + if($encodings or $encodings != 'utf-8') $code = helper::convertEncoding($code, $encodings); + return $code; } diff --git a/module/svn/config.php b/module/svn/config.php index 14d82b8e85..dc4fcd29b9 100644 --- a/module/svn/config.php +++ b/module/svn/config.php @@ -4,7 +4,7 @@ * client: svn客户端执行文件的路径,windows下面考虑安装Slik-Subversion,然后找到svn.exe的路径。linux下面比如/usr/bin/svn * repos可以是多个,需要设定某一个库的访问路径,以及用户名和密码。 * - * encodeings: the encoding of the comment,can be a list. + * encodings: the encoding of the comment,can be a list. * client: the svn client binary path. You can install Slik-Subversion unser windows, then find the path of svn.exe. under linux, try /usr/bin/svn * Can set multi repos, ervery one should set the path, username and password. * diff --git a/module/svn/model.php b/module/svn/model.php index 72f4509ca5..9d7d15a3f9 100644 --- a/module/svn/model.php +++ b/module/svn/model.php @@ -419,6 +419,10 @@ class svnModel extends model $cmd = $this->client . " diff -r $oldRevision:$revision $url"; $diff = `$cmd`; + + $encodings = isset($repo->encodings) ? $repo->encodings : $this->config->svn->encodings; + if($encodings or $encodings != 'utf-8') $diff = helper::convertEncoding($diff, $encodings); + return $diff; } @@ -445,6 +449,10 @@ class svnModel extends model $cmd = $this->client . " cat $url@$revision"; $code = `$cmd`; + + $encodings = isset($repo->encodings) ? $repo->encodings : $this->config->svn->encodings; + if($encodings or $encodings != 'utf-8') $code = helper::convertEncoding($code, $encodings); + return $code; }