
สวัสดีครับพี่ๆ เพื่อนๆ ผมมีปัญหาเกี่ยวกับการใช้งาน Ionic native bluetooth serial ซึ่งหลังจากทำการ Connect กับ Bluetooth Printer แล้วสั่งให้ทำการเขียนซึ่งไม่สามารถแสดงผลเป็นภาษาไทยได้ แต่ภาษาอังกฤษได้ปกติ เพื่อนๆ พี่ๆ น้องๆ คนไหนเคยเจอปัญหานี้บ้าง มาแชร์ หรือบอก KeyWord ให้ศึกษาต่อขอบคุณมากครับ

// Write a string
this.bluetoothSerial.write('hello world').then(success, failure);
// Array of int or bytes
this.bluetoothSerial.write([186, 220, 222]).then(success, failure);
// Typed Array
var data = new Uint8Array(4);
data[0] = 0x41;
data[1] = 0x42;
data[2] = 0x43;
data[3] = 0x44;
this.bluetoothSerial.write(data).then(success, failure);
// Array Buffer
this.bluetoothSerial.write(data.buffer).then(success, failure);
--------------------------------------------------------------------------------------------------------------------------------
จากตัวอย่างด้านบน
this.bluetoothSerial.write('hello world').then(success, failure); <<< โอเค
this.bluetoothSerial.write('สวัสดี').then(success, failure); <<< พิมพ์ออกเป็นต่างดาว
จากที่สอบถาม และศึกษาเพิ่มเติม อาจจะต้องทำการ Convert String เป็น Tis620, UTF8 ก่อนรึเปล่า (ไม่แน่ใจ) ในตัวอย่างของ Doc Manual เค้าให้แปลงเป็น Array Buffer ซึ่งไม่เคยทำ
ใครใคร่รู้วิธี โปรดชี้แนะด้วยครับ
สอบถามเรื่อง ionic 3 framework เรื่องการใช้ Plugin Ionic native Bluetooth serial.write() พิมพ์ภาษาไทยไม่ออก
// Write a string
this.bluetoothSerial.write('hello world').then(success, failure);
// Array of int or bytes
this.bluetoothSerial.write([186, 220, 222]).then(success, failure);
// Typed Array
var data = new Uint8Array(4);
data[0] = 0x41;
data[1] = 0x42;
data[2] = 0x43;
data[3] = 0x44;
this.bluetoothSerial.write(data).then(success, failure);
// Array Buffer
this.bluetoothSerial.write(data.buffer).then(success, failure);
--------------------------------------------------------------------------------------------------------------------------------
จากตัวอย่างด้านบน
this.bluetoothSerial.write('hello world').then(success, failure); <<< โอเค
this.bluetoothSerial.write('สวัสดี').then(success, failure); <<< พิมพ์ออกเป็นต่างดาว
จากที่สอบถาม และศึกษาเพิ่มเติม อาจจะต้องทำการ Convert String เป็น Tis620, UTF8 ก่อนรึเปล่า (ไม่แน่ใจ) ในตัวอย่างของ Doc Manual เค้าให้แปลงเป็น Array Buffer ซึ่งไม่เคยทำ
ใครใคร่รู้วิธี โปรดชี้แนะด้วยครับ