verbs2016
V2EX  ›  微软

git 上传 windows 项目,资源文件中的内容乱码

  •  
  •   verbs2016 · Nov 21, 2018 · 3110 views
    This topic created in 2935 days ago, the information mentioned may be changed or developed.

    用 vs2013 编写的 windows 程序,项目下有一个 resource.rc 的文件中有中文,上传到 git 仓库,checkout 出来时就会乱码,请问该如何解决?谢谢大神们啦(^_^)

    PS:

    1. git 版本:git version 2.15.1.windows.2
    2. 目前 git 的配置:可以提交中文信息,可以显示中文 Log。
    4 replies  •  2018-11-21 14:33:33 +08:00
    yidinghe
    yidinghe
    PRO
    Nov 21, 2018
    2
    另外检查一下文件编码,最好统一为 UTF-8 编码。
    verbs2016
    verbs2016
    OP
    Nov 21, 2018
    3
    @yidinghe 这个地方设置过了.gitattributes 文件里面有设置的 >*.rc text eol=crlf
    git config --global 里也设置了 core.autocrlf=true
    文件编码,vs2013 好像都是 gbk 的编码
    verbs2016
    verbs2016
    OP
    Nov 21, 2018
    4
    找到原因了:
    是因为添加的资源文件(.rc 和 .h)的字符编码与.cpp 的不同,不知道为什么会产生这种情况。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4095 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:21 · PVG 17:21 · LAX 01:21 · JFK 04:21
    ♥ Do have faith in what you're doing.