我不能用sewoo热敏打印机打印泰语作为php的原始数据

i am trying to print thai language on thermal printer sewoo SLK-T21EB. I can print english language and i can change font size of english language also with esc/pos commands. But when I try to print thai language it prints something i cannot understand. I am using php language to do this. i have to print receipts for my app.If i try to print thai language with some other program in windows, i can print. I am using wamp server. My code is

<?php
$ph = printer_open("THERMAL Receipt Printer");
echo "$ph";
printer_set_option($ph, PRINTER_MODE, "RAW");
printer_set_option($ph, PRINTER_PAPER_FORMAT, PRINTER_FORMAT_CUSTOM);
printer_set_option($ph, PRINTER_PAPER_LENGTH, 50);
printer_set_option($ph, PRINTER_COPIES, 1);
printer_start_doc($ph, "PHP Document");
printer_start_page($ph);

const ESC = "\x1b";
const FS = "\x1c";
const GS="\x1d";
const NUL="\x00";

$InitializePrinter= ESC."@";
$bigchar=ESC."E".chr(1);
$bigsize=GS."!".chr(1111);
printer_write($ph, $InitializePrinter);
printer_write($ph, $bigchar); //bold
printer_write($ph, $bigsize); //size
printer_write($ph, "data string to print");
printer_write($ph, "ฟกดเพำ");
printer_end_page($ph);
printer_end_doc($ph);
printer_close($ph);
?>

please help...

The problem seems to be either that you haven't told the printer what kind of languages it should be printing or that you haven't encoded the Thai string propperly.

You could try

printer_write($ph, utf8_encode("ฟกดเพำ"));

Or you could try a command which will set the language format for the printer to Thai. Since i did not see such a command in your post. I had a similar problem when trying to print swedish characters in Java. But i used bytes instead of strings :)

According to an answer given here can i change printer_write in another language? you can not change the language of the printer from php, perhaps you could change the language by going to the settings for the printer ? Anyhow let me know if you got this solved.