+ Reply to Thread
Results 1 to 7 of 7

SSMS and unicode files

  1. SSMS and unicode files

    Hi,

    Looking for a way to configure SSMS (either 2005 or 2008) to save files
    (specifically, sql code) using ASCII/ANSI instead of UNICODE.

    A vendor's custom build/install tool won't process UNICODE correctly,
    and this is our only workaround.

  2. Re: SSMS and unicode files

    That should be the default, however you can override the default behavior
    using the "Save with Encoding" menu. In SSMS with a query window focused,
    go to File | Save As and on the Save button pull the little arrow down...
    Choose "Save with Encoding" and you will see a dialog called "Advanced Save
    Options"... Here you can change encoding from Western European (Windows) -
    Codepage 1252 (the default in my locale at least) to about 100 other styles.

    A


    On 1/5/09 3:29 PM, in article uq4nZR3bJHA.1184atTK2MSFTNGP05dotphx.gbl,
    "horseradish" wrote:

    > Hi,
    >
    > Looking for a way to configure SSMS (either 2005 or 2008) to save files
    > (specifically, sql code) using ASCII/ANSI instead of UNICODE.
    >
    > A vendor's custom build/install tool won't process UNICODE correctly,
    > and this is our only workaround.



  3. Re: SSMS and unicode files

    Aaron,

    > That should be the default, however you can override the default behavior
    > using the "Save with Encoding" menu. In SSMS with a query window focused,
    > go to File | Save As and on the Save button pull the little arrow down...
    > Choose "Save with Encoding" and you will see a dialog called "Advanced Save
    > Options"... Here you can change encoding from Western European (Windows) -
    > Codepage 1252 (the default in my locale at least) to about 100 other styles.


    Save with Encoding works, but it's annoying to try and remember. My
    problem files seem to all be encoded with 1200 (standard Unicode); 1252
    would be acceptable (that's not unicode), so something else is going on...
    >
    > A
    >
    >
    > On 1/5/09 3:29 PM, in article uq4nZR3bJHA.1184atTK2MSFTNGP05dotphx.gbl,
    > "horseradish" wrote:
    >
    >> Hi,
    >>
    >> Looking for a way to configure SSMS (either 2005 or 2008) to save files
    >> (specifically, sql code) using ASCII/ANSI instead of UNICODE.
    >>
    >> A vendor's custom build/install tool won't process UNICODE correctly,
    >> and this is our only workaround.

    >


  4. Re: SSMS and unicode files

    They really shouldn't be doing that, unless you installed Windows, or SQL
    Server, or the tools, in some non-standard codepage somehow. In fact there
    is a Connect item opened a long time ago about this. Perhaps there is some
    registry setting that tells SSMS how to save files, but Microsoft hasn't
    told us where to find it?

    http://connect.microsoft.com/SQL/fee...edbackID=33675
    0



    On 1/5/09 4:00 PM, in article ObF1di3bJHA.1184atTK2MSFTNGP05dotphx.gbl,
    "horseradish" wrote:

    > Aaron,
    >
    >> That should be the default, however you can override the default behavior
    >> using the "Save with Encoding" menu. In SSMS with a query window focused,
    >> go to File | Save As and on the Save button pull the little arrow down...
    >> Choose "Save with Encoding" and you will see a dialog called "Advanced Save
    >> Options"... Here you can change encoding from Western European (Windows) -
    >> Codepage 1252 (the default in my locale at least) to about 100 other styles.

    >
    > Save with Encoding works, but it's annoying to try and remember. My
    > problem files seem to all be encoded with 1200 (standard Unicode); 1252
    > would be acceptable (that's not unicode), so something else is going on...
    >>
    >> A
    >>
    >>
    >> On 1/5/09 3:29 PM, in article uq4nZR3bJHA.1184atTK2MSFTNGP05dotphx.gbl,
    >> "horseradish" wrote:
    >>
    >>> Hi,
    >>>
    >>> Looking for a way to configure SSMS (either 2005 or 2008) to save files
    >>> (specifically, sql code) using ASCII/ANSI instead of UNICODE.
    >>>
    >>> A vendor's custom build/install tool won't process UNICODE correctly,
    >>> and this is our only workaround.

    >>



  5. Re: SSMS and unicode files

    Aaron wrote:
    > They really shouldn't be doing that, unless you installed Windows, or SQL
    > Server, or the tools, in some non-standard codepage somehow. In fact there
    > is a Connect item opened a long time ago about this. Perhaps there is some
    > registry setting that tells SSMS how to save files, but Microsoft hasn't
    > told us where to find it?
    >
    > http://connect.microsoft.com/SQL/fee...dbackID=336750


    The comments in the Connect stream referenced was the tip on my issue. I
    have a chunk of files that were updates to existing SQL objects: I used
    the SSMS Script->Create to create the basis for the updated object, then
    saved the file to capture the updated object.

    Sometimes, the resulting object was totally different, but I wanted to
    reuse some small chunk of code in the original.

    Either way, the result is a Unicode 1200 file.

    Now that I understand this (significant) limitation, I won't be
    surprised. I'll just get into the habit of setting the encoding whenever
    I do a saveas...

  6. Re: SSMS and unicode files

    horseradish (dontcallmeatillcalludotnet) writes:
    > Looking for a way to configure SSMS (either 2005 or 2008) to save files
    > (specifically, sql code) using ASCII/ANSI instead of UNICODE.
    >
    > A vendor's custom build/install tool won't process UNICODE correctly,
    > and this is our only workaround.


    I seem to get CP1252 by default, but I don't save files that often from
    SSMS.

    Anyway, there is another option beside Save with Encoding. In
    Tools->Option->Text Editor, select .SQL and in the dropdown in the bottom
    of the dialog select SQL Query Editor with encoding. Everytime you open
    a new query window, you will get a drop-down that requires you to select
    the encoding. It's likely to drive you made, but you could at least try it.


    --
    Erland Sommarskog, SQL Server MVP, esquelatsommarskogdotse

    Links for SQL Server Books Online:
    SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
    SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
    SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx


  7. Re: SSMS and unicode files

    That I understand. SSMS will not change the encoding of a pre-existing file
    that you happened to open and modify (unless you override it). Probably
    easiest to script to clipboard or to new query editor window, and then save
    from there, in which case you can set the right encoding from the start.


    "horseradish" wrote in message
    news:u0NyRu4bJHA.1916atTK2MSFTNGP02dotphx.gbl...
    > Aaron wrote:
    >> They really shouldn't be doing that, unless you installed Windows, or SQL
    >> Server, or the tools, in some non-standard codepage somehow. In fact
    >> there
    >> is a Connect item opened a long time ago about this. Perhaps there is
    >> some
    >> registry setting that tells SSMS how to save files, but Microsoft hasn't
    >> told us where to find it?
    >>
    >> http://connect.microsoft.com/SQL/fee...dbackID=336750

    >
    > The comments in the Connect stream referenced was the tip on my issue. I
    > have a chunk of files that were updates to existing SQL objects: I used
    > the SSMS Script->Create to create the basis for the updated object, then
    > saved the file to capture the updated object.
    >
    > Sometimes, the resulting object was totally different, but I wanted to
    > reuse some small chunk of code in the original.
    >
    > Either way, the result is a Unicode 1200 file.
    >
    > Now that I understand this (significant) limitation, I won't be surprised.
    > I'll just get into the habit of setting the encoding whenever I do a
    > saveas...




+ Reply to Thread