anchor.diff:  function UTF8Length(const s: string): integer;
   begin
     if s = '' then
  -    Result := length(s)
  +    Result := 0
     else
       Result := UTF8Length(PChar(s),length(s));
   end;
  
positive.code: {
    Some handly UTF8 function copied from the Lazarus LCL. Comes from the LCLProc
    unit. Surely we can move this into FPC?
  }
  unit gfx_UTF8utils;
  
  
negative.code:   end;
  end;
  
  // returns the character index, where the SearchForText starts in SearchInText
  function UTF8Pos(const SearchForText, SearchInText: string): integer;
  var
   p: LongInt;
  begin
    p := System.Pos(SearchForText, SearchInText);
    if p > 0 then
      Result := UTF8Length(PChar(SearchInText), p-1) + 1
    else
      Result := 0;
  end;
  
  procedure UTF8Delete(var S: string; Index, Size: integer);
  var
    ls: integer;
    b: string;
    e: string;
  begin
    ls := UTF8Length(S);
    if (Index > ls) or (Index <= 0) or (Size <= 0) then
      Exit; //==>
    b := UTF8Copy(S, 1, Index-1); // beginning string
    e := UTF8Copy(S, Index+Size, UTF8Length(S)-(Index+Size-1)); // ending string
    S := b + e;
  end;
  
  procedure UTF8Insert(const Source: string; var S: string; Index: integer);
  