Kin

Kin

 

svn list 显示中文乱码问题的解决方法 [转载]

svn list 显示中文乱码问题的解决方法 [原创 2007-11-07 21:15:26]   
我顶 字号:

很久没用svn命令,忽然发现:

C:\Documents and Settings\Administrator>svn list --non-interactive "file:///D:/u
sr/svn/repositories/demo/"
dir 2/
dir1/
?\230?\150?\176?\229?\187?\186?\230?\150?\135?\228?\187?\182?\229?\164?\185/
?\230?\150?\176?\229?\187?\186?\230?\150?\135?\228?\187?\182?\229?\164?\185 (2)/


C:\Documents and Settings\Administrator>

返回的内容竟然是乱码,正确的应该是:

dir 2/
dir1/
新建文件夹
新建文件夹 (2)

安装最新版本的svn: 1.4.5 ,重启Windows,问题还是存在。

在网上找了很久,最后,在http://www.etng.net/blog/2006/09/26/subversion-14%e7%89%88%e6%9c%ac%e7%9a%84windows%e6%9c%8d%e5%8a%a1%e9%85%8d%e7%bd%ae%e6%96%b9%e6%b3%95/  找到了解决方法,文章说,设置Windows系统环境变量:

LANG=zh_CN.UTF8
APR_ICONV_PATH=C:\Program Files\Subversion\iconv
SVN_EDITOR=notepad.exe

就可以解决。设置方法:对“我的电脑”按右键,选择“属性”,选择“高级”栏,单击“环境变量”,检查“系统变量”列表是否有上述3个参数,如果有则进行修改,如果没有,则进行添加;修改完后,按多次“确定”。 此时,系统环境变量已经生效,再打开命令提示符,执行命令:

Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>"C:\Program Files\Subversion\bin\svn.exe
" list file:///D:/usr/svn/repositories/demo
dir 2/
dir1/
新建文件夹/
新建文件夹 (2)/

C:\Documents and Settings\Administrator>

中文显示正常了。

至于是否可以设置 LANG=zh_CN.GBK   或者 zh_CN.GB2312 或者 zh_CN.GB13000 等,我尝试了各种取值,似乎不影响svn的输出结果。

APR_ICONV_PATH的设置应该是关键所在,因为iconv目录保存了各种编码的转换配置文件。按我的猜想:有了这些配置文件,就可以实现从Unicode与本地编码的转换,从而实现任意编码之间的转换。不知道猜得对不对?经过测试,如果APR_ICONV_PATH没有配置,则可能导致乱码,如果APR_ICONV_PATH配置错误,则很可能导致乱码。当APR_ICONV_PATH配置正确时,总能正确显示中文路径,因此,应正确配置APR_ICONV_PATH。

至于,SVN_EDITOR=notepad.exe,的配置,似乎没使用用处。

如果是在DOS批处理中,可以使用:

set LANG=zh_CN.UTF8
set APR_ICONV_PATH=C:\Program Files\Subversion\iconv
set SVN_EDITOR=notepad.exe

来设置环境变量,确保svn命令需要的环境变量配置正确。

posted on 2009-02-20 00:44 kin 阅读(3716) 评论(12)  编辑 收藏 引用

评论

# re: svn list 显示中文乱码问题的解决方法 [转载] 2010-07-06 21:30 HallieNorton

We can speak a lot just about the chronicle of papers writing, but will state that the <a href="http://www.essaysprofessors.com/how-to-buy-an-essay.html">how to buy an essay</a> service could compose the best <a href="http://www.essaysprofessors.com/essay-paper.html">essay paper</a> eternally. Am I wrong?   回复  更多评论   

# re: svn list 显示中文乱码问题的解决方法 [转载] 2010-07-15 15:08 term papers

I was doing each of research looking at some other term papers writing. and this is the fifth link to the search essay about this post as relayed by Google… so you are careful that you are add a free service for them and embellish their traffic. So if you morally support this then you should take the money but if your attitude has dominate at all and you’re against it then you should believably drag them. But it's still yours to choose.  回复  更多评论   

# re: svn list 显示中文乱码问题的解决方法 [转载] 2010-08-08 01:28 home loans

Do not enough money to buy a house? You should not worry, because that is achievable to take the loan to resolve all the problems. Hence get a consolidation loan to buy all you require.   回复  更多评论   

# re: svn list 显示中文乱码问题的解决方法 [转载] 2010-08-11 18:24 buy an essay

It is hard a bit to find information close to this topic,but essay writing services would suggest to buy an essay to receive proper knowledge and thst’s available to order written essays per very small costs!   回复  更多评论   

# re: svn list 显示中文乱码问题的解决方法 [转载] 2010-11-09 01:07 buy dissertation

In the complicated way to the academic grade people have to buy thesis sample corresponding with this topic in the buy thesis service or professional dissertation writing.   回复  更多评论   

# re: svn list 显示中文乱码问题的解决方法 [转载] 2011-07-23 04:44 essay service

I never think that I do not correctly when come to the essay papers service and order essay papers. Moreover, that aids me mastering writing techniques.   回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


导航

统计

常用链接

留言簿

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜