[DUG] widestring woes, MBCS through tcp
Todd Martin
toddm at kol.co.nz
Thu Nov 23 10:48:13 NZDT 2006
Could you not avoid the problem completely by storing the text "Details" in
encoded Base64 format?
Todd.
----- Original Message -----
From: "Phil Scadden" <p.scadden at gns.cri.nz>
To: <delphi at delphi.org.nz>
Sent: Thursday, November 23, 2006 10:17 AM
Subject: [DUG] widestring woes, MBCS through tcp
> 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
>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.409 / Virus Database: 268.14.6/536 - Release Date: 16/11/2006
>
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.6/536 - Release Date: 16/11/2006
More information about the Delphi
mailing list