On Tue, 31 Dec 2013, Juha Manninen wrote:

On Mon, Dec 30, 2013 at 9:17 PM, Mattias Gaertner
<nc-gaert...@netcologne.de> wrote:
if FindInvalidUTF8Character(PChar(Pointer(s)),length(s))<0 then
  // UTF-8

Uhhh! I will be totally screwed when I must do a unicode conversion myself.
What was this "PChar(Pointer(s))" again? PChar is a pointer, why does
it need a double cast?

Pchar(Ansistring) has some special compiler treatment.

If you omit the double cast, pchar(S) will point to a #0 character for an empty 
string.
If you include the double cast, PChar(Pointer(s)) is Nil for an empty string.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to