qzind / tray

Browser plugin for sending documents and raw commands to a printer or attached device.
https://qz.io
Other
838 stars 272 forks source link

ESC/POS "$" Dollar sign changed to "¥" Yen/Yuan sign #1145

Closed yaredga closed 10 months ago

yaredga commented 1 year ago

Hello, good afternoon. I wanted to ask if by any chance someone knows why when I add this to my ticket '\x1B' + '\x4D' + '\x31', which I understand is to make the text smaller, it works fine for me, but I have an error where the dollar sign "$" is changed to "¥" and I have no idea why. Everything else in the ticket is correctly changed and made smaller, but only that symbol changes.

tresf commented 1 year ago

@yaredga can you please share all of your code so that we can reproduce?

In short, the $ should not change to the ¥, however there are scenarios (custom fonts or character replacements) that may cause this. Having the commands would be a good start to see if they're modifying the behavior.

Furthermore, these printers often cannot handle unicode characters, so often a different encoding / codepage is needed to print different currency symbols.

Once we have the larger picture of your print content, we can try to figure out why the currency is incorrect.

yaredga commented 1 year ago

this is my code

function printTextPlanpos(serverPath) {
    var config = getUpdatedConfig();
//    var cf = qz.configs.create("POS-80");
    serverPath = serverPath.replace("_corta_", '\x1D' + '\x56' + '\x00');
    var textoPequeño = ('\x1B' + '\x4D' + '\x31');
//    console.log(serverPath);
//    var printData = [{
//            type: 'raw', format: 'plain', data: serverPath, options: {language: "ESCPOS"}
//        }
//    ];

    var data = [{
            type: 'raw',
            format: 'image',
            flavor: 'file',
            data: 'https://www.sangabriel.mx/images/home/logo-sangabriel-2.png',
            options: {
                language: "ESCPOS"
//        dotDensity: '32'
//pageHeight: 2 
            }
        }, {
            type: 'raw',
            format: 'command',
            flavor: 'plain',
            data: textoPequeño + serverPath, options: {language: "ESCPOS"}
        }];

    // qz.print(config, printData).catch(displayError);
    qz.print(config, data).then(function () {
        // alert("Sent data to printer");
        qzDonePrinting();
    }).catch(function (e) {
        console.log(e);
        qzDonePrintingCancel();
        // displayError
    });
}
tresf commented 1 year ago

Thank you, nothing stands out as problematic.

What model printer is this? Do you have a second one to confirm that the issue is consistent between similar hardware?

tresf commented 10 months ago

Closing due to lack of response. I believe the printer's settings and/or firmware are configured to perform this character substitution. For that reason, I expect this issue to resurface in the future, we can reopen it at that time when we have more information about the problem.