为什么Mercurial认为我的SQL文件是二进制文件? [英] Why does Mercurial think my SQL files are binary?

查看:76
本文介绍了为什么Mercurial认为我的SQL文件是二进制文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚使用SQL Server Management Studio编写了SQL Server存储的proc,表定义等脚本,并尝试将它们添加到我的Mercurial源代码控制存储库中.他们添加的很好,但是现在当我更改和比较它们时,Mercurial称它们为二进制文件",并且没有给我适当的统一差异.

I just scripted out my SQL Server stored procs, table definitions, etc using SQL Server Management Studio, and tried to add them to my Mercurial source control repository. They got added just fine, but now when I change and diff them, Mercurial calls them "binary files" and doesn't give me a proper unified diff.

我认为编码可能是一个问题,所以我尝试重新生成脚本并为文本文件输出指定ANSI,但是我得到了相同的行为.我可以在记事本中很好地查看它们,而不会出现任何看起来奇怪的字符.为什么Mercurial认为这些文件是二进制文件?

I thought the encoding might be a problem, so I tried regenerating the scripts and specifying ANSI for the text file output, but I get the same behavior. I can view them just fine in notepad without any odd-looking characters showing up. Why does Mercurial think these files are binary?

否则,如果有人可以推荐一个好的工具来编写可能不会导致此问题的SQL Server数据库脚本,那也可能会起作用.

Otherwise, if someone can recommend a good tool for scripting out a SQL Server database that might not cause this issue, that might work, too.

推荐答案

我遇到了这个问题,因为SQL Server Management Studio将文件另存为Unicode. Unicode文本文件的前两个字节(大部分时间)定义了编码.大多数较新的文本编辑器(例如记事本)都是透明处理的.

I've run into this problem because SQL Server Management Studio saves the files as Unicode. The first two bytes (most of the time) of a Unicode text file define the encoding. Most newer text editors (e.g. Notepad) handle this transparently.

前两个字节可能是您的问题所在.它们看起来像like.或FF FE(十六进制).

The first two bytes are probably where your problem is. They may look like ÿþ. Or FF FE in hex.

在保存"对话框的保存"按钮上是一个选择列表.选择使用编码保存...",然后选择"US-ASCII-Codepage20127".我相信此设置具有粘性,并将保留以备将来保存.

On the "Save" button on the Save dialog is a pick list. Choose "Save with Encoding..." and select "US-ASCII-Codepage20127". I believe this setting is sticky and will remain for future saves.

这篇关于为什么Mercurial认为我的SQL文件是二进制文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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