[DUG] widestring woes, MBCS through tcp
Phil Scadden
p.scadden at gns.cri.nz
Thu Nov 23 10:17:09 NZDT 2006
Having some hassles with hebrew. I have tcp service (indy) that is reading
data from database, sending it to custom tcp client for display. Problem
when the text includes some hebrew.
The display side needs to detect it has a MBCS. Looks at Ord of character
in passed string. Okay.
When I fetched from database with ADOTable1.FieldbyName('Details').asstring
then everything went well. I used iohander.writeln and readln to read the
data in plain strings.
Changed to ADOQuery1 instead.
ADOQuery1.fieldbyname('Details').asstrings returns the string with all the
hebrew characters converted to '?' (Ord = 63)
if I go ord(ADOQUERY1.FieldByName('Details').aswidestring[183]) where
183 is position of hebrew character, I get say 1513. Good.
now
var teststr:Widestring
teststr := ADOQUERY1.FieldByName('Details').aswidestring;
ord(teststr[183]) = 63 !!!! WTF.
Even assigneding to widestring is causing the characters to be converted
to '?'
BDS2006. I am lost here. what is going on??
----------------------------------------------------------
Phil Scadden, Institute of Geological and Nuclear Sciences
764 Cumberland St, Private Bag 1930, Dunedin, New Zealand
Ph +64 3 4799663, fax +64 3 477 5232
More information about the Delphi
mailing list