I use printer function to print out some data in a text file (.txt) that contains Chinese and English word. Both of them can display correctly in the webpage. When printing, the English word looks well but the Chinese word doesn't show the correct output. Any suggestion to overcome this? below is my coding. Please help me.
<?php
$print = file_get_contents("print.txt");
$printer = "XP-80"; //printer name
echo $print;
if($ph = printer_open($printer))
{
printer_set_option($ph, PRINTER_MODE, "RAW");
printer_write($ph, $print);
printer_close($ph);
}
?>
There are a few things I can think of that might be the cause of the issue:
printer_set_option()
about a bug. It's from 2009, so not sure if it's still valid.Edit after you comment:
Try this example from reference manual
$font = printer_create_font("Arial", 148, 76, PRINTER_FW_MEDIUM, false, false, false, -50);
printer_select_font($ph, $font);
I used the following code to solve this problem:
$textprinting = "your text";
utf8_decode($textprinting);