anchor.diff:  var
     CharLen: LongInt;
   begin
  -  Result:=0;
  -  while (ByteCount>0) do
  +  Result := 0;
  +  while (ByteCount > 0) do
     begin
       inc(Result);
  -    CharLen:=UTF8CharacterLength(p);
  -    inc(p,CharLen);
  -    dec(ByteCount,CharLen);
  +    CharLen := UTF8CharacterLength(p);
  +    inc(p, CharLen);
  +    dec(ByteCount, CharLen);
     end;
   end;
   
  
positive.code:     begin
        // could be 2 byte character
        if (ord(p[1]) and %11000000) = %10000000 then
          Result:=2
        else
          Result:=1;
      end
      else if ((ord(p^) and %11110000) = %11100000) then
      begin
  
negative.code: var
    CharLen: LongInt;
  begin
    Result := UTF8Str;
    if Result <> nil then
    begin
      while (Index > 0) and (Len > 0) do
      begin
        CharLen := UTF8CharacterLength(Result);
        dec(Len, CharLen);
        dec(Index);
        inc(Result, CharLen);
      end;
      if (Index > 0) or (Len < 0) then
        Result := nil;
    end;
  end;
  
  function UTF8CharacterLength(p: PChar): integer;
  begin
    if p <> nil then
    begin
      if ord(p^) < %11000000 then
      begin
        // regular single byte character (#0 is a character, this is pascal ;)
        Result:=1;
  