Is anybody aware of a way to set the default encoding when saving a file to in SQL Server Management Studio to be ANSI instead of Unicode? Our source control system/diff tools barf when it runs across a Unicode file format.

I've googled a possible solution for this; but all I've found are examples to select the encoding when doing a "Save As..."; which works fine; but needs to be done every time I launch the program.

Is there a registry setting somewhere I could set? Has anybody else run into this and found a solution?


This feature has been requested for the past 4 years by dozens of people, however, this still hasn't been implemented that I can see.


I believe it may be possible to do this. I wanted the reverse situation - files always saved in Unicode rather than ANSI - and I found a Registry setting that enabled me to do that. The Registry Key is HKEY_USERS\\Software\Microsoft\Microsoft SQL Server\\Tools\Shell\General and the REG_DWORD value is SaveDocsAsUnicodeInDataLoss which was set to 0. I changed it to 1 and the default encoding when saving files switched from ANSI to Unicode.

I infer from that that setting the value to 0 defaults to ANSI.

To change the setting for any future users, change the value in the HKEY_USERS\.DEFAULT\Software\Microsoft\Microsoft SQL Server\\Tools\Shell\General key.

  • Setting this to 0 does NOT change encoding to ANSI – kmote Oct 27 '15 at 16:34

ANSI is not a good default unless absolutely necessary. UTF-8 is much, much better. UTF-8 is generally compatible with ANSI. (UTF-8 without signature is compatible, and is good. UTF-8 with signature is a non-compatible (and bad) alternative to UTF-8 without signature. The only purpose to add the signature is make it incompatible to ANSI!) But any Unicode format supports international characters, which is normally very good. ANSI has very (very) limited international character support. The world should transition to UTF-8 (without signature). Apparently HTML5 agrees. Horay! Finally a smart character encoding standard.

  • 3
    -1 This doesn't answer the question. – Péter Török Jul 19 '12 at 13:59
  • This may be more appropriate as a comment to the question, instead of an answer – JoelFan Mar 20 '19 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.