We have a process that writes XML (Using SQL's FOR XML). When it was executed via SQLCMD in a batch file the output was in UTF-8 format (specifically 8-bit ascii characters become 2 byte). When I do the same thing through Execute SQL Command in SSIS it's not UTF-8 encoded.
Here's a simple example. The ® should become 2 bytes:
SELECT 'Diversity® Certified' as fldAgentLastName
FOR XML PATH('agent'), ELEMENTS, TYPE, ROOT('agents')
The output is: Diversity® Certified
it SHOULD be: Diversity® Certified
and was using SQLCMD. I understand that internally XML is stored as UCS-2(?), but I need a way to get the output as UTF-8 encoded data (not just 8-bit).
I also cannot use the BCP trick I've seen mentioned.
I don't want to use the CDATA tag because that would entail recreating a giant ugly query.
Everything I've found on the web doesn't encode the high ascii characters.
This is running on SQL Server 2008 R2.