SQL Server Management Studio 2005 - Set Default Encoding

7

2

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?

Jim B

Posted 2010-11-22T14:00:09.973

Reputation: 255

Answers

7

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.

WoodE

Posted 2010-11-22T14:00:09.973

Reputation: 246

1

It's a 7 year-old feature request as of this comment. Please vote here: https://connect.microsoft.com/SQLServer/feedback/details/336750/need-a-way-to-set-the-default-encoding-for-query-files-in-smss

– Caio Proiete – 2015-07-07T13:53:08.200

0

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.

Liam North

Posted 2010-11-22T14:00:09.973

Reputation: 1

Setting this to 0 does NOT change encoding to ANSI – kmote – 2015-10-27T16:34:16.553

-4

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.

Humilulo -- Shawn Kovac

Posted 2010-11-22T14:00:09.973

Reputation: 1

This may be more appropriate as a comment to the question, instead of an answer – JoelFan – 2019-03-20T17:21:45.903

3-1 This doesn't answer the question. – Péter Török – 2012-07-19T13:59:12.823