I am having issues with some files in automated processes, specifically with batch files and sql files. Visual Studio seems to create these as UTF-8 rather than ansi and adds some kind of special characters to the beginning of the file (I think this is a called a pre-amble) This breaks running batch files and running swl files through osql.exe. I have had issues myself in the past in creating text files using C#, but can get around that through encoding. However its seems a bit strange I cant use Visual studio to create batch files and sql files in a database project for automation.
2 Answers
You can use Save As and then click the little arrow right next to the Save button. There you select Save with encoding and select UTF-8 without signature (or whatever suits you; for Batch files you probably want Western European (DOS) – 850) in the list.
I think I have answered my own question by finding this answer on Stack Overflow:
https://stackoverflow.com/questions/854360/visual-studio-inserts-invalid-characters-in-batch-files
and more info on the characters here: http://en.wikipedia.org/wiki/Byte-order_mark