lsongdev / lsongdev/node-escpos
UTF-8 not work for thai language (Always print chinese characters)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.6k
- Forks
- 443
- PR merge metrics
- No merged PRs in 30d
Description
I have tried UTF-8 to print the Thai characters but I got Chinese characters instead.
This is my code
```js
const escpos = require("escpos");
escpos.USB = require("escpos-usb");
const device = new escpos.USB();
const options = { encoding: "UTF8" };
const printer = new escpos.Printer(device, options);
device.open(function (error) {
printer
.size(0, 0)
.font("a")
.align("ct")
.style("b")
.text("สวัสดี")
.cut()
.close();
});
```
This is the result

Expected result
Should print `สวัสดี` in the paper
How to fix it?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue through the escpos.USB device, escpos.Printer options, and the .text("สวัสดี") call shown in the report. Trace how the UTF8 encoding option reaches the printer and compare the emitted data with the printer's Thai character support. Done means Thai text prints as สวัสดี rather than Chinese characters, with a regression check if the project provides one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100