Как сделать чтобы имя файла было нормальным?
- Код: Выделить всё
unit ufrmMain;
{$mode objfpc}
{$H+}
{$codepage utf8}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
PrintersDlgs;
type
TForm1 = class(TForm)
Button1 : TButton;
PrintDialog1 : TPrintDialog;
procedure Button1Click(Sender : TObject);
private
public
end;
var
Form1 : TForm1;
s : string;
su : unicodestring;
s8 : UTF8String;
sa : AnsiString;
implementation
uses Printers;
{$R *.lfm}
procedure TForm1.Button1Click(Sender : TObject);
begin
s:='Заголовок string';
su:='Заголовок unicode';
s8:='Заголовок utf8';
sa:='Заголовок ANSI';
if PrintDialog1.Execute then
with Printer do begin
Title:=s;
begindoc;
enddoc;
Title:=su;
begindoc;
enddoc;
Title:=s8;
begindoc;
enddoc;
Title:=Utf8ToAnsi(s8);
begindoc;
enddoc;
Title:=sa;
begindoc;
enddoc;
end;
end;
end.