Skip to content

Set escpos binary file encoding type in environment variable#67

Open
PratikBodawala wants to merge 1 commit intoreceipt-print-hq:masterfrom
PratikBodawala:feature/61-esc2html-encoding
Open

Set escpos binary file encoding type in environment variable#67
PratikBodawala wants to merge 1 commit intoreceipt-print-hq:masterfrom
PratikBodawala:feature/61-esc2html-encoding

Conversation

@PratikBodawala
Copy link

@PratikBodawala PratikBodawala commented Feb 10, 2020

#61

Setting the Environment variable "SOURCE_ENCODING" for other than CP437 encoding

@PratikBodawala
Copy link
Author

Hello, @welcoMattic, @mike42
Could you review my PR and provide feedback?

@mike42
Copy link
Contributor

mike42 commented Feb 10, 2020

Hi,

I've taken a look at the code. Can you share an example file which you're running this with, and the make/model of printer that you use?

I would be interested to know whether I can make an alternative solution work for your use case, by adjusting the current code page each time we encounter an ESC t (select code page) command in the file. A single file will often access characters from many different code pages, and this would be the correct way to handle that.

The default code page (encoding to assume if none is specified in the actual file) is another matter entirely, and an environment variable is certainly a good way to handle that.

@PratikBodawala
Copy link
Author

With environment variable

image

Without environment variable

image

model: HOP-801

As I mentioned in issue #61, I need 1/4, 1/2, and 3/4. The default charset has 1/4 and 1/2. But not 3/4 so, I search for other encodings which are supported by this model, so, latin1 is supported and print just fine. but when I convert it to html it was decoding from wrong charset. Following file in latin1 charset.

test90.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants