I Have a Zebra ZD220t and i do need to print some labels which have Arabic and English on the same label , i did tried all the possible options and it seems that somehow XOJO is messing up the Arabic part.
I imported the source csv but using a plugin on another project , i use Chilkat to load the csv and on the file encoding , because it comes from a windows machine i put csv.LoadFile2(FileName, "windows-1256" ) which made the text to show properly.
Now, on my side i try testing one test code found on the internet which is
#If TargetWindows Then
Dim printer As New directPrint
Dim job As Integer
If printer.Open("barcode") Then
job= printer.StartDoc("BClabel")
If job > 0 Then
If printer.StartPage Then
Call printer.Write("^XA")
Call printer.Write("^PW464") ' 58 mm * 8 dots per mm = 464 dots
Call printer.Write("^LL312") ' 39 mm * 8 dots per mm = 312 dots
Call printer.Write("^CI28")
Call printer.Write("^CWZ,E:TT0003M_.TTF")
Call printer.Write("^FT60,100^PA0,1,1,1^AZN,30^FDBonjour en Arabe : ŘµŘ¨Ř§Ř Ř§Ů„Ř®ŮŠ^FS")
Call printer.Write("^XZ")
printer.EndPage
End If
printer.EndDoc
End If
printer.Close
End If
#EndIf
In the meantime i did play with the Zebra Designer and tried to export the ZLP code for it and it seems that if i paste this in the Call printer.Write, i get it printed properly but it seems that it converts the arabic into graphics then saves it and encodes it in a Z64 format then it prints
I have no idea about Arabic but looking at the writing , this is what i Input â€śŘµŘ¨Ř§Ř Ř§Ů„Ř®ŮŠâ€ť and look at the label what it prints. From what i got that is wrong , so i assume that is an encoding issue.
Might be. You are also changing script directions in the middle of a line of text, which may throw the printer for a loop. Given the fact that the text is correct except for the first character or two, I tend to think that your encoding is correct and there’s a glitch in the printer.
Try printing your Arabic text without the Latin text and see what happens.
Well, printing same thing with the Zebra designer app, it works properly and whatever i input there it prints same thing so i doubt that the printer has issues and from what i read ^PA allows bidirectional text which should allow it to handle it properly .
Strings in Xojo are UTF8 by default. If you place your test into a string variable and then use convert encoding to swap it to the correct encoding you may solve the problem. In terms of encodings “Windows-1256” is called “WindowsArabic” by Xojo.
var ArabicStringUTF8 as String = "Bonjour en Arabe : ŘµŘ¨Ř§Ř Ř§Ů„Ř®ŮŠ"
var ArabicStringWin as String
ArabicStringWin = ArabicStringUTF8.ConvertEncoding( Encodings.WindowsArabic )
#If TargetWindows Then
Dim printer As New directPrint
Dim job As Integer
If printer.Open("barcode") Then
job= printer.StartDoc("BClabel")
If job > 0 Then
If printer.StartPage Then
Call printer.Write("^XA")
Call printer.Write("^PW464") ' 58 mm * 8 dots per mm = 464 dots
Call printer.Write("^LL312") ' 39 mm * 8 dots per mm = 312 dots
Call printer.Write("^CI28")
Call printer.Write("^CWZ,E:TT0003M_.TTF")
Call printer.Write("^FT60,100^PA0,1,1,1^AZN,30^FD" + ArabicStringWin + "^FS")
Call printer.Write("^XZ")
printer.EndPage
End If
printer.EndDoc
End If
printer.Close
End If
#EndIf
Is it possible that “directPrint” converts everything to UTF8? Try using standard Xojo printer commands to send your instructions? Although that looks too high level, especially for a label printer.
apparently no, i took the code from here from the forum and adapt it to work on the latest xojo , and it uses RAW to send the data to winspool.drv
I don’t see any encoding parameters
Yes, very. It proves that the ConvertEncoding is actually doing the job. It is possible that the Zebra requires z64 encoding to cope with non-ascii input. Trouble with z64 is it required LZ77, which I’m not aware of an option for Xojo. You could just try Base64, which is the other half of the equation.
Well, unfortunately does not work, your code is just printing the Base64 converted string and that’s about it, in order to print graphics you need more than that but i tested all the options and no luck
To my uneducated eye, the Arabic part seems fine for the second word, but wrong for the first one. If encoding is the same for all the Arabic part, how can only the first word be wrong ?