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
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to