Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publishing DACPAC file with MSDeploy, UTF8 characters in post-deploy script are lost

I have a DACPAC file that was built in Visual Studio 2013, for an SSDT project. This SSDT project defines a post-deploy script designed to merge some static data into the published tables, and one piece of data contains a copyright symbol.

Now, when I publish the database through Visual Studio, the copyright symbol is preserved, and merged correctly into the target table. When I publish the same database (with the same dacpac and publish profile) using MSDeploy, the copyright symbol is merged into the target database as a "?" symbol. Likewise, when I use Action:Script instead of Action:Publish, the generated SQL script contains a "?" rather than the copyright symbol.

It seems as if the script Visual Studio is generating is UTF8 encoded, but the script that gets baked into the dacpac loses the UTF8 encoding. Does anyone have any ideas of how to work around this issue?

like image 625
Michael J. Heier Avatar asked Mar 13 '15 21:03

Michael J. Heier


1 Answers

I had the same issue. Open this file in notepad and 'save as' UTF-8 encoding in the same folder to replace the old one. Then publish again. It should work.

Notepad Screenshot

like image 82
Nan Zheng Avatar answered Sep 28 '22 16:09

Nan Zheng