mike42 / escpos-php UTF-8没有打印西里尔文

时间:2018-01-30 21:51:03

标签: php utf-8 printing

我想在Cyrillic打印机上打印XPRINTER XP-58 pos

我尝试下面的代码,但它不打印所有字母,如果是这样,它打印输出严重。这是我在此代码中获得的结果,但并非所有字母都缺失:  ----ЅЈКЉЊЌЃ---------信件

如果有任何有此经验的人请帮助我。提前谢谢你,

我的代码:

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');
}

Picture of what is being printed right now

0 个答案:

没有答案