0

我正在尝试编写一个实用程序来将代码从我们的自定义源代码管理迁移到 git。

旧系统中的“提交”消息被增量添加到项目路径中的文本文件中,所以我使用 git 将这些文件从一个版本差异到下一个版本,然后使用该差异作为提交消息。

不出所料,我在口音方面遇到了麻烦。

测试字符串是:éèàçüûöôëê

  1. 源文本文件(记事本告诉我)在“ANSI”中。
  2. 如果我在 msysgit 中做一个差异,我会看到这个<E9><E8><E0><E7><FC><FB><F6><F4><EB><EA>
  3. 当我使用相同的 diff 命令运行对 git 的 Process 调用时(请参阅问题),我得到:
    1. ÚÞÓþ³¹÷¶ÙÛ
    2. ����������StandardOutputEncoding = Encoding.UTF8根据这个问题。
    3. éèàçüûöôëêStandardOutputEncoding = Encoding.Default

到目前为止,一切都很好,但是如果我éèàçüûöôëê作为提交消息发回,git 会告诉我Warning: commit message does not conform to UTF-8.

关于如何使它工作的任何指示?这个问题也谈到了在 StandardInput 上设置编码,但我的提交消息在参数中,而不是输入的一部分。

(Git 还说我可以设置 config 变量i18n.commitencoding,但如果可以的话,我宁愿尊重 git 格式)

4

1 回答 1

0

Looks like it's got nothing to do with .net or Process, or maybe even git. As far as I can tell, there's no way to type accents in bash anyway.

And in spite of the warnings from git, the commit messages are readable by other tools (gitk), so maybe all is well.

于 2010-06-22T10:54:45.630 回答