I have a MS SQL Server database with nvarchar data, and in particular a data field with "★ABC★" in it. My Delphi desktop application displays it fine, but the same data from my WebBroker application in Delphi XE4 that uses a TDataSetTableProducer to generate the response doesn't work. Here's the bare bones sample code:
procedure TWebModule1.WebModule1TestAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
Response.ContentEncoding := 'text/plain; charset="UTF-8"';
Response.Content := '<!DOCTYPE html>'
+ '<html>'
+ '<body>'
+ '<p> ★ABC★ </p>'
+ '</body>'
+ '</html>'
end;
When viewed in a web browser, the result is "?ABC?". I've tried lots of things (including UTF-16 and prefixing the response with Char($FEFF)), but nothing helps. What's the right way to do this?