gpt4 book ai didi

svn - 如何强制 SVN 默认将 UTF-16 XML 文件检测为明文文件?

转载 作者:行者123 更新时间:2023-12-04 20:01:34 25 4
gpt4 key购买 nike

我们有很多 xml 文件,其中大部分是 UTF-16 编码的。

当我使用 SmartSVN 添加一个文件到 subversion 时,它总是得到 svn:mime-type=application/octet-stream。

这会阻止 SmartSVN 的可视化 DIFF 工具处理这些非常烦人的文件。

来自 SVN 常见问题解答: http://subversion.apache.org/faq.html#binary-files

When you first add or import a file into Subversion, the file is examined to determine if it is a binary file. Currently, Subversion just looks at the first 1024 bytes of the file; if any of the bytes are zero, or if more than 15% are not ASCII printing characters, then Subversion calls the file binary. This heuristic might be improved in the future, however.

当使用 UTF-16 文件时,这是非常愚蠢的,因为在大多数情况下它们包含 ~50% 的零。

我还读到有一种方法可以从 SVN 客户端自动设置属性: http://www.mediawiki.org/wiki/Subversion/auto-props

这是否也允许删除自动检测到的二进制 MIME 类型?

是否可以通过某种方式在存储库/svn 服务器上进行设置,这样我就不必在每个工作站上进行设置?

最佳答案

  1. 您不能仅为 UTF-16 XML 重新定义 mime 类型(但可以 - 对于所有 xml)
  2. 我不知道在服务器或每个存储库的基础上重新定义 mim 类型的好方法

如果以上几点没有吓到你,你可以全局(每个客户端的主机)在客户端的颠覆配置文件上重新定义 mime 类型:%AppData%\Subversion\config, [auto -props] 部分。有点像

*.xml = svn:mime-type=text/xml

关于svn - 如何强制 SVN 默认将 UTF-16 XML 文件检测为明文文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13608819/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com