Recent

Author Topic: can't print 'ü','ö','ä'  (Read 7312 times)

ace

  • Newbie
  • Posts: 4
can't print 'ü','ö','ä'
« on: October 21, 2006, 01:32:17 pm »
Hi , i can't print 'ü','ö','ä' with lazarus.


example: i write 'ä' the printer prints ' Ķ' why?

My os is ubuntu/Kubuntu :cry:

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
RE: can
« Reply #1 on: October 21, 2006, 01:42:00 pm »
Which commands are you using to print?

ace

  • Newbie
  • Posts: 4
can't print 'ü','ö','ä'
« Reply #2 on: October 21, 2006, 03:33:16 pm »
Hi sekel, i take this commands


Code: [Select]

 procedure TForm1.ToolButton6Click(Sender: TObject);

var drucker : Tprinter;

var H, Line : Integer;

begin

   if PrintDialog1.Execute then

     begin

  Drucker := Printer;
   Drucker.BeginDoc;
     Drucker.Canvas.Font.Name := 'Arial';
       Drucker.Canvas.Font.Size := 12;
         H := Drucker.Canvas.TextHeight('Gg') + 2;
           for Line := 0 to memo.Lines.Count do begin
             Drucker.Canvas.TextOut(25, 25 + Line * H, memo.Lines[Line]);

end;

Drucker.EndDoc;

end;

end;


ace :roll:

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
can't print 'ü','ö','ä'
« Reply #3 on: October 21, 2006, 05:29:09 pm »
I am guessing, but I think that the printer expects UTF-8 encoding, and Lazarus GTK 1 interface outputs ISO encoding. You can try to fix this by changing this line:

             Drucker.Canvas.TextOut(25, 25 + Line * H, memo.Lines[Line]);

to:

             Drucker.Canvas.TextOut(25, 25 + Line * H, AnsiToUTF8(memo.Lines[Line]));

or something similar

ace

  • Newbie
  • Posts: 4
can't print 'ü','ö','ä'
« Reply #4 on: October 21, 2006, 07:51:02 pm »
Hi sekel, i changed the line but i have the same problem.Any idea?

the follow lines can i read in /var/lib/locales/supported.d/de
de_DE.UTF-8 UTF-8
de_CH.UTF-8 UTF-8
de_BE.UTF-8 UTF-8
de_LU.UTF-8 UTF-8
de_AT.UTF-8 UTF-8
de_DE@euro ISO-8859-15

ace

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
can't print 'ü','ö','ä'
« Reply #5 on: October 21, 2006, 08:58:21 pm »
Maybe it's the other way around. Your system is passing UTF-8 to LCL that doesn't modify it, but the printer driver expects ISO. So you could try:

Drucker.Canvas.TextOut(25, 25 + Line * H, UTF8ToAnsi(memo.Lines[Line]));

ace

  • Newbie
  • Posts: 4
can't print 'ü','ö','ä'
« Reply #6 on: October 22, 2006, 05:42:27 pm »
That's it ,Thanks sekel :D  :D  :D

MfG ace

 

TinyPortal © 2005-2018