LoadFromFile Copy and Utf-8 lazarus / 31-LCL ---------------------------------------------------------------------- Nicola Gorlandi · 2018-07-07 06:26 I have a file with this content ò1234567890 and i want to read it and extract from 2 to 4 characters for each rows. If I use this code QuoteLinee:= TStringList.Create;  Linee.LoadFromFile(FileName);  Showmessage(Copy(linee[0]2,4)); copy count the UTf-8 char as if it si long two chars. Could you please give me any explanation ? I am using the last versione Lazarus 1.8.2 32 bit on Windows. ---------------------------------------------------------------------- Thaddy · 2018-07-07 07:10 Quote from: Nicola Gorlandi on July 07, 2018, 08:26:39 amcopy count the UTf-8 char as if it si long two chars. No, UTF8 is 1-4 characters, not 2. https://en.wikipedia.org/wiki/UTF-8 ---------------------------------------------------------------------- Nicola Gorlandi · 2018-07-07 07:13 Thank you,  Whatever UTF-8 char lenght is,  I would like to count the char as human does, so im my case ò shiuld be counted as o. Is it possible with Lazarus or I have to manage by myself ? Many thanks again. ---------------------------------------------------------------------- wp · 2018-07-07 11:48 In such a context it is good to know the unit LazUnicode which provides an easy enumerator of the utf8 code points: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  LazUnicode; procedure TForm1.Button1Click(Sender: TObject);var  s, ch, str: String;  n: Integer;begin  Memo1.Lines.Clear;  str := 'ò1234567890äöüßÄÖÜ';  n := 0;  for ch in str do begin    s := s + ch;    inc(n);    Memo1.Lines.Add('The first ' + IntToStr(n) + ' code point(s): ' + s);  end;end; ---------------------------------------------------------------------- Bart · 2018-07-07 11:59 Utf8Copy() Bart ---------------------------------------------------------------------- Nicola Gorlandi · 2018-07-08 07:49 Many thank to all I solved. Just an annotation. With the last version of lazarus I supposed that using string I could use utf8 without any changes of code. This is my misunderstanding