FreePascal lijkt anders om te gaan met Utf8Decode dan Delphi (in ieder geval anders dan D7).
Wat is de output van onderstaand programma op een moderne Delphi?

Delphi Code:
  1. program u;
  2.  
  3.  
  4. {$apptype console}
  5. {$assertions on}
  6. {$ifdef fpc}
  7. {$codepage cp1252}
  8. {$mode objfpc}
  9. {$h+}
  10. {$endif fpc}
  11.  
  12. uses
  13.   SysUtils;
  14.  
  15. {$ifndef fpc}
  16. type
  17.   UnicodeString = WideString;
  18. {$endif}
  19.  
  20. var
  21.   AStr: AnsiString;
  22.   UStr: UnicodeString;
  23.  
  24. begin
  25.   AStr := 'äëï';
  26.   Assert((Byte(AStr[1])=$E4) and (Byte(AStr[2])=$EB) and (Byte(AStr[3])=$EF),'AStr is not singlebyte encoded.');
  27.   UStr := Utf8Decode(AStr);
  28.   writeln('Length(UStr)=',Length(UStr));
  29. end.

Delphi 7: Length(UStr)=0
fpc: Length(UStr)=3

De type definitie van UnicodeString is wellicht overbodig in modernere Delphi's?
Die assert is om te checken of mijn editor niet per ongeluk de broncode toch als UTF-8 heeft opgslagen.

Bart