[DUG] Get the number representation of WideChar?
Todd Martin
toddm at kol.co.nz
Wed Oct 18 10:48:23 NZDT 2006
Do you have the following MBCS functions in Delphi 5?
CharLen()
ByteType()
You should be able to use ord() for each byte in the character.
Todd.
----- Original Message -----
From: "Gajo Csaba" <csaba at enyem.com>
To: <delphi at ns3.123.co.nz>
Sent: Wednesday, October 18, 2006 1:21 AM
Subject: [DUG] Get the number representation of WideChar?
> Hello,
>
> I haven't been active on this list for several years, so I hope you're
> still alive :)
> I have a problem with Unicode characters. I'm doing a conversion from IDN
> to PunyCode. IDN is the domain name in any character set, for example in
> Arabic letters. This is converted to something like xn--fd4ewg.com
> (Punycode) so it is accessible eveywhere.
>
> I'm using Delphi 5. For Unicode characters I'm using the TNT component
> set.
>
> Now, to convert IDN strings to Punycode, I need to check each character.
> If Ord(ch) > 127 then it's a Unicode and I have to convert it.
> The problem is it looks like Ord doesn't support WideChar's. If I do Ord
> on any russian letter it will always work as if I've used Ord('?').
> Because of this, my conversion function always fails.
>
> Is there some way to get the number representation of a Unicode char?
>
> Also, I'm using AnsiPos for retrieving the starting position of
> substrings. Is there some similar method for Copy? For example, I'm not
> sure if Copy(str,1,1) will copy a wide character correctly, since
> WideChars are 2 bytes. I know that accessing wide chars with str[1] is
> wrong.
>
> Regards,
> Csaba
>
> _______________________________________________
> 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.408 / Virus Database: 268.13.4/476 - Release Date: 14/10/2006
>
>
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.4/476 - Release Date: 14/10/2006
More information about the Delphi
mailing list