首页 > 代码库 > subversion-1.8.17+apache2.2.32   http无法访问中文仓库名

subversion-1.8.17+apache2.2.32   http无法访问中文仓库名

SVN从Windows迁移到linux


在搭建好环境后,中文名字的仓库无法通过http访问

命令行测试正常

svn  co svn://xx.xx.xx.xx/测试


但是通过http就不行

svn  co http://xx.xx.xx.xx/测试


查看Apache 错误日志

发现错误

 (20014)Internal error (specific information not available): Can‘t convert string from ‘UTF-8‘ to native encoding:

(20014)Internal error (specific information not available): /webapp/svndata/?\\230?\\150?\\135?\\228?\\187?\\182?\\230?\\136?\\150?\\231?\\155?\\174?\\229?\\189?\\149/format


无法将中文UTF-8转码

有人说是 错误数字都不大于255,应该是ASCII编码只转了7位,高位的丢失了。

搜索了N多解决方案都不行,还以为是个BUG

最后在官网找到答案

http://svnbook.red-bean.com/en/1.8/svn.serverconfig.httpd.html#svn.serverconfig.httpd.ref.mod_dav_svn


  • SVNUseUTF8 On|Off

  • When set to Onmod_dav_svn will communicate with hook scripts using repository root paths encoded in UTF-8, and will expect those scripts to likewise generate output (such as error messages) encoded in UTF-8. The default value of this option is Off, which means that mod_dav_svn assumes a 7-bit ASCII encoding for its hook script interactions. This option is available as of Subversion 1.8.

    技术分享

    Administrators should ensure that the character set and encoding expectations of hook scripts match all the ways they might be invoked. For example, if one repository is served by both httpd and svnservesvnserve should also be configured to use UTF-8 (by setting an appropriate locale in its environment) if this option is enabled for mod_dav_svn. Also, local filesystem paths containing non-ASCII characters which will be accessed by those scripts (such as repository root paths) must be properly encoded in the filesystem to match the scripts‘ expectations.



最后,在apache的配置文件httpd.conf里添加

<IfModule mod_dav_svn.c>

SVNUseUTF8  On

</IfModule>


重启apache,问题解决!!

当然 这个参数只在1.8版本中有效。

本文出自 “无所适从” 博客,请务必保留此出处http://tommypage.blog.51cto.com/6689011/1925166

subversion-1.8.17+apache2.2.32   http无法访问中文仓库名