Is this because SQL Server encodes to UTF-16?
I had a similar issue accessing and displaying text from a MYSQL database which was easily remedied by using
Code: Select all
SpecificOptions.Values['MySQL.CharSet']:='UTF8'
Code: Select all
SpecificOptions.Values['MySQL.CharSet']:='UTF8'
Code: Select all
var
rbs: RawByteString;
begin
rbs := UTF8Encode(UniQuery.FieldByName('fieldname').AsString);
// now rbs contains the string in the UTF-8 character set, which you can use on your webpage
end;
Code: Select all
var AWideString:WideString;FieldValue:String;
AWideString:=DataRS.fieldbyName('data').AsWideString;
FieldValue:=UTF8Encode(WideFieldValue);
Code: Select all
//DataRS is of type TUniQuery
WideSQLStatement:=UTF8Decode(SQLStatement);
DataRS.sql.text:=WideSQLStatement;
Code: Select all
UniQuery.SQL.Text:='SQL statement with Unicode characters';
UniQuery.Open;