How to customize the printing of Cyrillic characters?

Hello. I use this driver for printing with thermal printers (receipt printers). My model of printer Xprinter XP-80
Code for a simple output check this:
require __DIR__ . '/vendor/autoload.php';
use Mike42\Escpos\PrintConnectors\NetworkPrintConnector;
use Mike42\Escpos\Printer
use Mike42\Escpos\CapabilityProfile;
$profile = CapabilityProfile::load("CP866");
$connector = new NetworkPrintConnector("192.168.1.200", 9100); //Printer/Server IP
$printer = new Printer($connector, $profile);
try {
$printer -> text("there stands a green oak;\n");
$printer -> text("a Gilded chain on the oak tree:\n");
$printer -> text("day And night the cat scientist\n");
$printer -> text("Everything goes on a chain around;\n");
$printer -> cut();
} finally {
 $printer -> close();
}

The Latin is printed just fine. But with Cyrillic troubles. Printed scrawl. Play with $profile as advised in the West, but nothing helps. Maybe someone managed to print non-English characters?
April 7th 20 at 11:01
1 answer
April 7th 20 at 11:03
Solution
And what's the source encoding? Utf-8 ?

General recommendation such that the encoding of the file corresponds to the output code page, or use the conversion.
For example iconv
The source encoding is UTF-8. I'm trying to convert utf8 to cp1251 printer gives an error type it only accepts utf8 - rebeca_Wiza commented on April 7th 20 at 11:06
@rebeca_Wiza, https://wiki.microinvest.su/index.php?title=%D0%9A...

Is your printer? A test page printed? - jesse_Turcotte commented on April 7th 20 at 11:09
@jesse_Turcotte please tell me how solved the problem? Now sit poking around with the profiles, all the same Abra kadabra ( - mack45 commented on April 7th 20 at 11:12
@mack45, I'm not tinkering with printers. Just giving advice which might suit.
Some devices do have to load the raster image instead of the font and map of matrix characters. - jesse_Turcotte commented on April 7th 20 at 11:15
@jesse_Turcotte Oh, wanted to ask @rebeca_Wiza . But it turned out to solve the problem, made a new profile, pointed strictly one code base CP1251 and all perfectly worked. But thanks for the reply! - mack45 commented on April 7th 20 at 11:18
@mack45, I am Glad I suggested. Make possible your actions in the most short recipe for how to achieve the desired result. - jesse_Turcotte commented on April 7th 20 at 11:21
Library resources added a new profile in the file capabilities.json.
"cool": {
 "codePages": {
 "0": "CP1251"
},
 "colors": {
 "0": "black"
},
 "features": {
 "barcodeA": true,
 "barcodeB": true,
 "bitImageColumn": true,
 "bitImageRaster": true,
 "graphics": false,
 "high density": true,
 "paperFullCut": true,
 "paperPartCut": true,
 "pdf417Code": true,
 "pulseBel": false,
 "pulseStandard": true,
 "qrCode": true,
 "starCommands": false
},
 "fonts": {
 "0": {
 "columns": 42,
 "name": "Font A"
},
 "1": {
 "columns": 56,
 "name": "Font B"
}
},
 "media": {
 "width": {
 "mm", "Unknown",
 "pixels": "Unknown"
}
},
 "name": "P822D",
 "notes": "",
 "vendor": "PBM"
},


And then applied the new profile
$profile = CapabilityProfile::load("cool");

Not yet figured out how to make a profile and apply it, not by editing a package file (which is a very bad practice).

Don't know if it helped and if it passed this step successfully, but with the utility of the printer has changed his code-base . In my case it is Atol RP80, the utility is called PrjRp80(Codepage&Program).exe. Changed to WCP1251 [Cyrillic] . But again, not sure exactly what all was successful, since no test page is not popped up (but supposed). - mack45 commented on April 7th 20 at 11:24

Find more questions by tags PHP