I loaded Northwind database to my sql server 2005. I am extracting a nested
xml using (BCP) the following query below. As you know that Northwind database
has a lot of European names with special characters. The data gets
extracted properly. However, when I try to view the file in IE (8.0), I get
an error, "An invalid character was found in text content".
WHERE Orders.CustomerID = Customer.CustomerID
FOR XML AUTO, ELEMENTS, TYPE, ROOT ('orders')),
(SELECT DISTINCT LastName, FirstName
FROM Employees Employee
JOIN Orders Orders ON Orders.EmployeeID = Employee.EmployeeID
WHERE Customer.CustomerID = Orders.CustomerID
FOR XML AUTO, ELEMENTS, TYPE, ROOT ('employees'))
FROM Customers Customer
FOR XML AUTO, ELEMENTS, TYPE, ROOT ('customers')
I understand the cause of the error. IE is trying to view the file with
UTF-8 encoding. Obviously by adding the UTF-16 encoding statement to this
file is not going to work. The real solution is that the file must be
created with UTF-16 encoding.
How can I achieve this?
I would appreciate your help.