rardark
rardark

Reputation: 41

Delphi 2009 - Sending Printer Commands in UTF8

I am writing an Delphi 2009 program that sends the escape command to the label printer for printing barcode. Refer to Sending printer specific commands, I can use Windows.Escape() to do the job. But my question is our database stores UTF8 data(for storing different languages), may I ask if Windows.Escape() accepts UTF8 data?

Thanks

*I discovered that Escape accept PAnsiChar... enter image description here

Upvotes: 0

Views: 383

Answers (1)

David Heffernan
David Heffernan

Reputation: 613053

When using PASSTHROUGH, as the linked code does, the Escape API accepts raw 8 bit data which is not processed in any way by Escape. The data is passed directly to the device.

You can learn about the Escape function from its documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/dd162701.aspx

If the printer understands UTF-8, then your approach should work. But, if the printer does not understand UTF-8 it will fail. In other words this is not really a question about Escape, but rather a question about your printer. You will need to consult its documentation.

Reading between the lines of your question, it seems that you are letting the encoding used in your database drive your thinking regarding printing. That seems to me to be mistaken. There's no connection between your database and the printer. Whether or not your printer understands UTF-8 is unrelated to your database text encoding. You need to first work out what encoding the printer needs. If it is not the same as used by the database, then you will need to convert. Converting from one encoding to another is usually straightforward.

Upvotes: 1

Related Questions