twide3.pp 536 B

123456789101112131415161718192021222324252627282930313233343536
  1. { %skiptarget=win32,win64,wince }
  2. { This test is only usefull if the local codepage is utf-8 which
  3. usually not the case on windows
  4. }
  5. {$codepage utf-8}
  6. {$mode objfpc}
  7. uses
  8. {$ifdef unix}
  9. cwstring,
  10. {$endif}
  11. sysutils;
  12. {$i+}
  13. var
  14. t: text;
  15. w: widestring;
  16. a: ansistring;
  17. begin
  18. assign(t,'twide3.txt');
  19. rewrite(t);
  20. writeln(t,'łóżka');
  21. close(t);
  22. reset(t);
  23. try
  24. readln(t,a);
  25. w:=a;
  26. if (w<>'łóżka') then
  27. raise Exception.create('wrong string read');
  28. finally
  29. close(t);
  30. erase(t);
  31. end;
  32. end.