When I try to print some cyrillic characters in a label they do not appear correctly. Is there any special thing that I should do to pass the cyrillic characters to the zebra printer through Browser print?
My code:
//setting the priners var barcode = "123456789"; var product_name = "Тестов продкт"; var product_price = "2.93 лв." var zpl = "^XA^CWT,E:ARI000.FNT^CFT,20,20^CI28^BY2,3,57^FT20,170^BCN,,Y,N^FD" + barcode + "^FS^FO20,50^FB370,2^FWn^FH^FD" + product_name + "^FS^FT390,40^FWr^FH^FD" + product_price + "лв^FS^PQ1,0,1,Y^XZ"; var stockReceiptPrinter = null; var barcodePrinter = null; $(document).on('ready', function () { BrowserPrint.getLocalDevices(function (result) { result.printer.forEach(function (printer) { if (printer.name === '24a070200057') { barcodePrinter = printer; } else if (printer.name === '46j094300866') { stockReceiptPrinter = printer; stockReceiptPrinter.send(zpl); } }); }, function () {}); });
I am using BrowserPrint v1.0.4.min.js and zebra-browser-print-setup-1.2.0.3.exe
7 Replies
Hello, Yanko!
You have to user EncodeURI on your product_name var. Here’s my code
“SplitNameInParts” function is just for splitting long text into 20 characters parts to print in two lines on a sticker. The point is to user EncodeURI, here’s piece of my js script:
var parts = splitNameInParts(bc_descr, 20)
//Начальная позиция первой строки наименование типа
var pos = 95
//Начать сеанс работы
var p = '^XA'
//Стартовые координаты печати x,y
p += '^LH30,20'
//Штрих-код (Тут лучше ничего не трогать)
p += 'F30,10BY2'
p += '^BCN,64,Y,N,N,A'
p = '^FD'barcode+'^FS'
//Установка шрифта (Тут тоже лучше ничего не трогать)
p += '^CWT,E:TT0003M_.FNT'
//Размер шрифта
p += '^CFT,25,25'
//Кодировка utf-8
p += '^CI28'
//Построчная печать наименования типа документа
for (var i = 0; (i < 3)&&(!!parts[i]); i++) {
pos += 25
p = ('^FT0,'pos'FHFD'encodeURI(parts[i]).replace (/%/g, '_')+'^FS')
}
//Конец сеанса работы
p = p + '^XZ'
//Отправка команды в принтер
selected_printer.send(p);
Maxim Cherniyaev
are there any news about this issue?
Hi, Robin.
Same problem here.
I wonder if we have to choose other solution for this issue.
ZPL command through zebra setup utilities works fine but the same command via browser print doesn't work.
I checked BrowserPrint.js sends request to the local server(port 9100/9101) with request header sets charset utf-8 on firefox and edge.
So the problem might be the local server's encoding or some processes of the requested string on the server side.
Please let us know the expected date when possible.
Hi, Robin.
I hope this issue will be patched soon.
Could you let me know expected date?
Hi Yanko, Unfortunately I believe this is part of a known issue with certain multi-byte characters that is being worked on now. We will let you know when there is a patch.
Hi Robin, thanks... I am not very happy with this because I based my solution on "Browser print" but I look forward to the patch.
By the way congrats for the "Browser print" feature/plugin it is totally awesome, keep working in this direction.
could you please take a look?