GitHub:对文件使用UTF-8编码 [英] GitHub: Using UTF-8 encoding for files

查看:211
本文介绍了GitHub:对文件使用UTF-8编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么UTF-8不是GitHub的默认编码?

这是否意味着从默认的cp1252更改?

Does that mean that there are any drawbacks to change from the default "cp1252"?

与Windows和Mac OSX之间的平台使用GitHub有什么关系吗?

Does it have anything to do with using GitHub across platforms between Windows and Mac OSX?

使用GitHub提出问题,但可以询问有关 Git的一般情况

The question is asked from using GitHub, but can be asked about Git in general.

我主要是在.NET,HTML5和Javascript中进行开发,如果这个问题很重要。

I'm mostly doing development in .NET, HTML5 and Javascript, if that matters in the subject.

推荐答案

Wild guess: are you using TortoiseGit? Is that were you're seeing a default encoding set to cp1252?

如果是这样,它只是TortoiseGit使用Windows安装的默认编码。

If so, it's simply TortoiseGit using the default encoding of your Windows installation.

编辑:与Git GUI完全相同

Exactly the same is true for the Git GUI

这是一个 git开发者邮件列表中的讨论给出一个解释:

Here's a discussion from a git developer's mailing list giving an explanation:



  • 将diff和blame默认为系统(语言环境)编码,而不是硬编码UTF -8。

  • 添加一个gui.encoding选项以允许覆盖它。

  • gitattributes仍然有最后一个字。

其理由是Windows支持:

The rationale for this is Windows support:


  1. Windows用户习惯对文本
    文件使用传统编码。对于许多他们默认utf-8将是
    反直觉。

  2. Windows不支持utf-8语言环境,
    切换系统编码是一个真正的痛苦。因此选项。


这篇关于GitHub:对文件使用UTF-8编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆