折腾一天,终于搞定:
编辑 vi /etc/httpd/conf/httpd.conf,添加以下内容:
# 保证勾子中正确输出中文
<IfModule mod_dav_fs.c>
# Location of the WebDAV lock database.
DAVLockDB /var/lib/dav/lockdb
SVNUseUTF8 On
</IfModule>
其他解决办法:
shell:
添加 export LANG=en_US.UTF-8
#!/bin/sh
set -e
export LANG=en_US.UTF-8
REPOS="$1"
TXN="$2"
# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" > /svn/svn-repo/new_test/hooks/1.txt
python:
添加 env = {"LANG": "en_US.UTF-8"},执行命令时,设置env=env
#!/usr/bin/env python3
import subprocess
import sys
env = {"LANG": "en_US.UTF-8"}
_, repo_path, txn_name = sys.argv
output = subprocess.check_output(f"svnlook log -t {txn_name} {repo_path} ", shell=True, env=env)
log = output.decode('utf-8').strip()