Tablediff Utility – Output File Encoding in SQL Server

encodingsql serverssisunicode

When the SQL Server tablediff utility generates a file with differences between source and destination, if SSIS executes the script file which contains Arabic letters, then those letters are inserted as symbols.

Is there any way to to specify the code page for the output file ??
Or any work around ??

Note : it only works correctly when I manually change the encoding of the file from (UTF-8 without BOM) to (UTF-8).

Thanks

Best Answer

If you can manually change the encoding (to one that includes the Byte Order Mark) and have it work such that no characters are lost, then the file itself is fine.

It seems that the tablediff utility does not allow for specifying the encoding type of the output file, so you are left with two options:

  1. Configure SSIS to specify that script as being UTF-8 rather than relying upon the default encoding (which is probably ANSI). If that doesn't work, trying reading the script as "Unicode" (which is really UTF-16 Little Endian, which is how Windows & SQL Server store strings).

  2. Find a command-line utility that can convert the file encoding to UTF-8 (either unspecified or with BOM). This is certainly not the preferred approach ;-).