Recent

Author Topic: Windows CE printing turkish character  (Read 2001 times)

safa4141

  • Newbie
  • Posts: 3
Windows CE printing turkish character
« on: October 14, 2015, 01:35:40 am »
Hi, i am developing WinCE application with Lazarus. I'm using bluetooth dot-matrix printer to print invoice.
I'm sending printer to the text on windows 7 my printer prints turkish characters correctly. But i'm sending printer to windows CE 5.0 my printer doesn't  print
Turkish characters correctly. Only "?" printing for Turkish characters (İ, Ş, Ç, Ö)
Please help me!!!

my print code is;

Code: Pascal  [Select]
  1. procedure PrintInvoice(AText: String);
  2. var
  3.   buff : PByte;
  4.   FH: THandle;
  5.   sOutPut: String;
  6.   lenBuff: Integer;
  7.   RetW: DWORD;
  8.  
  9. begin
  10.  
  11.   sOutput :=UTF8ToConsole(AText);
  12.   lenBuff:=Length(sOutput);
  13.  
  14.   FH:= CreateFile('COM9:', GENERIC_READ or GENERIC_WRITE, 0, Nil, OPEN_EXISTING, 0, 0);
  15.  
  16.    if (FH = INVALID_HANDLE_VALUE) then
  17.       ShowMessage('Invalid handle!')
  18.    else begin
  19.    try
  20.       Buff:=PByte(@sOutput[1]);
  21.       WriteFile(FH, buff^, lenBuff, RetW, Nil);
  22.  
  23.       if Integer(RetW) = lenBuff then
  24.         ShowMessage('Printed!');
  25.    finally
  26.       Windows.CloseHandle(FH);
  27.    end;
  28.  
  29.   end;
  30.  
                                       

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Windows CE printing turkish character
« Reply #1 on: October 22, 2015, 12:26:32 pm »
  sOutput :=UTF8ToConsole(AText);

Try changing this into:

sOutput := AText;

or this:

uses lconvencoding;

sOutput := UTF8ToCP1254(AText);

See all available encoding conversion routines from lconvencoding here: http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/components/lazutils/lconvencoding.pas?view=markup&root=lazarus