Encoding when saving scripts

AvonWyssAvonWyss Posts: 35
I cannot find any place to specify the encoding to be used when scripts are being created through ScriptSynchronizationActions. In fact, I believe such an option does not exist at all in the current version (7.1).

The files are apparently saved as UTF8 without BOM. However, we would like to have the BOM added since some tools (including our soure control diff tool) recognize the file as being ANSI instead of UTF8, which has lead to problems. Strange enough, it almost seems that this was in V5.x and has been dropped?

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi,

    Sorry it's taken so long to get back to you, but we have been digging into previous documentation for SQL Comparison SDK and cannot find any method for setting encoding in any previous version, either. Since Synchronize to scripts had been introduced as a new feature in version 6 of the API, that left checking version 6 help, and the ScriptSynchronizationAction(s) classes don't seem to have any option for setting the script encoding that we can find.

    If you could provide a code sample on how you set the text encoding in the previous version of the API, I'd be happy to look into whether the option has changed or been moved somewhere else.

    Thanks!
  • While googling for answers, I stumbled across some code snippet which had some encoding setting (with a SaveToFile() method or so). I do not have code based on that, however.

    So, the question remains, how can I specify the encoding to be used?
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    edited November 4, 2008 8:50AM
    Hi,

    There aren't any encoding option on the SaveToFolder method, although there are some encoding options available for saving a single SQL migration script. I'm probably right in assuming that when synchronizing to a scripts folder, it's more important that the correct SQL collation is used rather than the text encoding.

    I will double-check on this and if it's needed, log a feature request for it based on the fact that the text encoding may be interfering with source control operation.
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Yes, I can confirm that there is no encoding option for synchronizing to script folders and the enhancement request for this issue is in our bug tracking system with an ID of SC-3999. Thanks for pointing it out.
  • There aren't any encoding option on the SaveToFolder method, although there are some encoding options available for saving a single SQL migration script.
    I found the location again... when using the BlockSaver.SaveToFile() method, the encoding can be specified. Would be nice to have this option everywhere. In fact, I would have expected it in the WriteToFileOptions class... ;)
Sign In or Register to comment.