{$codepage utf8} {$ifdef win32} Uses sysutils; {$endif} {$ifdef Unix} Uses sysutils,cwstring; {$endif} Var Arch:text; NombreArch:Unicodestring; BOM:String[3]; CadU:Unicodestring; CadUtf8:Ansistring; Begin NombreArch:='demo/Carta-01.txt'; {$ifdef Unix} NombreArch:='demo/手紙-01.txt'; {$endif} NombreArch:=SetDirSeparators(NombreArch); if FileExists(NombreArch) then Begin Assign(Arch,NombreArch); append(Arch); CadU:='Última línea'; Writeln(Arch,utf8encode(cadU)); reset(Arch); Read(Arch,BOM); if (BOM=#$EF+#$BB+#$BF) then Begin While Not(EOF(Arch)) do Begin Readln(Arch,CadUtf8); CadU:=utf8decode(cadUtf8); Writeln(utf8encode(CadU)) End; End; close(Arch) End; End.