SVN错误:无法将字符串从本机编码转换为"UTF-8" [英] SVN Error: Can't convert string from native encoding to 'UTF-8'
问题描述
我有一个提交后钩子脚本,当对存储库进行提交时,该脚本对工作副本执行SVN更新.
I've got a post-commit hook script that performs a SVN update of a working copy when commits are made to the repository.
当用户使用TortoiseSVN从Windows计算机上提交到存储库时,他们会收到以下错误消息:
When users commit to the repository from their Windows machines using TortoiseSVN they get the following error:
post-commit hook failed (exit code 1) with output:
svn: Error converting entry in directory '/home/websites/devel/website/guides/Images' to UTF-8
svn: Can't convert string from native encoding to 'UTF-8':
svn: Teneriffa-S?\195?\188d.jpg
上面有问题的文件是:Teneriffa-Süd.jpg
请注意带重音符号的u.这是因为该站点是德语,并且文件已用德语拼写.
The file in question above is: Teneriffa-Süd.jpg
notice the accented u. This is because the site is German and the files have been spelt in German.
在Linux命令行上对工作副本执行更新时,不会遇到任何错误.仅当Windows SVN客户端通过提交执行提交后挂钩时,才会出现上述错误.
When executing a update on the working copy at the Linux command-line no errors are encountered. The above error only exists when the post-commit hook is executed via a commit by a Windows SVN client.
问题:
- 为什么SVN会尝试更改文件的编码?
- 是否允许文件名包含Windows标准ASCII字符之外的字符?
更新:
Update:
事实证明,从Windows计算机(通过Samba)查看时,有问题的文件名正确显示为Teneriffa-Süd.jpg
,但是当我从文件所在的Linux服务器(使用SSH和PuTTY)查看文件名时,我得到了Teneriffa-Süd.jpg
It turns out that the file in question's filename correctly displays as Teneriffa-Süd.jpg
when viewed from a Windows machine (via Samba) but when I view the filename from the Linux server (using SSH and PuTTY) where the file resides I get Teneriffa-Süd.jpg
推荐答案
- 它不会更改文件的编码.它将文件名的编码更改(更改为每个客户端都希望能理解的名称).
- 由谁允许? NTFS使用16位代码点,Windows可以根据您的要求公开各种编码的文件名(它将尝试将其转换为您要求的编码).现在...这一点(您的要求)取决于您使用的特定svn客户端.在我看来,这就像是TortoiseSVN中的错误.
编辑以添加:
U.我误解了症状. svn服务器将所有内容都存储在utf-8中(似乎已经成功完成了此操作).
Ugh. I misunderstood the symptoms. the svn server stores everything in utf-8 (and it seems that it did that successfully).
提交后挂钩是无法从UTF-8转换的位.如果我正确理解了您的意思,则服务器上的提交后挂钩会触发对共享驱动器的svn更新(因此svn服务器会为其自身启动svn客户端...)?这意味着需要固定的配置是服务器上的客户端 的配置.
在执行svn服务器的环境中检查LANG/LC_ALL..碰巧的是,挂钩在真空环境(请参阅提示).因此,您应该在挂钩本身中设置变量.
The post-commit hook is the bit that fails to convert from UTF-8. If I understand what you're saying correctly, the post-commit hook on the server triggers an svn update to a shared drive (the svn server therefore starts an svn client to itself...) ? This means that the configuration that needs to be fixed is the one for the client on the server.
Check the LANG / LC_ALL on the environment executing the svn server.. As it happens, the hooks are run in a vacuum environment (see Tip). So you should set the variable in the hook itself.
另请参见此页面以获取有关如何操作的信息svn处理本地化
See also this page for info on how svn handles localisation
这篇关于SVN错误:无法将字符串从本机编码转换为"UTF-8"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!