1. 程式人生 > >subversion-1.8.17+apache2.2.32   http無法訪問中文倉庫名

subversion-1.8.17+apache2.2.32   http無法訪問中文倉庫名

svn apache mod_dav_svn utf-8 can't convert string from 'utf-8' to native encoding

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 On, mod_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 svnserve, svnserve 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無法訪問中文倉庫名