svn pre-commit 提交时输出中文的处理办法(ubuntu apache2)

在ubuntu环境下,svn的pre-commit中添加中文字符时:

LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c`
if [ "$LOGMSG" -lt 5 ];#要求注释不能少于 5 个字符,您可自定义
then
  echo -e "\n提交的信息说明内容不能为空!必须至少输入5个字符以上!\nLog message cann't be empty! you must input more than 5 chars as comment!." 1>&2
# echo "提交错误:提交的说明性信息内容必须至少有5个字符!" 1>&2
 exit 1
fi

# All checks passed, so allow the commit.
exit 0

提交代码发现错误提示:

[Error output could not be translated from the native locale to UTF-8.]“”

google后,进行如下更改:

1、更改/etc/apache2/envvars 中的内容:

源内容:

## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale

更改后内容:

## The locale used by some modules like mod_dav
#export LANG=C
## Uncomment the following line to use the system default locale instead:
. /etc/default/locale

2、重启apache: /etc/init.d/apache2 restart

再次在客户端提交commit,结果如下:

解决完成。

ref: 

https://stackoverflow.com/questions/2223958/pre-commit-hook-in-svn-could-not-be-translated-from-the-native-locale-to-utf-8

猜你喜欢

转载自blog.csdn.net/rainth/article/details/81176240