mike42/escpos-php UTF-8 no print Cyrillic

依然范特西╮ 提交于 2019-12-13 03:52:40

问题


I like to print Cyrillic on my XPRINTER XP-58 pos printer.

I tried below code but it doens't print all the letters and if so it prints the print-out badly. This is what I got as a result of this code, but not all letters are missing: ---- Ѕ Ј К Љ Њ Ќ Ѓ --------- LETTERS

If there is anyone with experience in this please help me. Thank you in advance,

My code:

public function index()
{
    $data = "";
    $data['test'] = array(['А Б В Г Д Ѓ Е Ж З Ѕ И Ј К Л Љ М Н Њ О П Р С Т Ќ У Ф Х Ц Ч Џ Ш']);
    $this->load->library("EscPos.php");
    try {        
        $connector = new Escpos\PrintConnectors\WindowsPrintConnector("XP-58");
        $profile = Escpos\CapabilityProfiles\DefaultCapabilityProfile::getInstance();
        $printer = new Escpos\Printer($connector,$profile);
        foreach ($data['test'] as $artikli){
            $printer -> text(iconv("UTF-8","GBK//IGNORE", "$artikli[0]") . "\n");
        }
        $printer -> text("\n\n\n");
        $printer -> cut();

        /* Close printer */
        $printer -> close();
    } catch (Exception $e) {
        echo "Couldn't print to this printer: " . $e -> getMessage() . "\n";
    }
    $this->load->view('welcome_message');
}

来源:https://stackoverflow.com/questions/48531109/mike42-escpos-php-utf-8-no-print-cyrillic

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!