react-native-bluetooth-escpos-printer 编码土耳其字符问题 [英] react-native-bluetooth-escpos-printer Encoding Turkısh Chracter Problem
本文介绍了react-native-bluetooth-escpos-printer 编码土耳其字符问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将打印土耳其语参数从 react-native 应用程序发送到 bixolon spp-r310 打印机.
I want to send print Turkish parameter from react-native app to bixolon spp-r310 printer.
我的代码是:
async print(BBcolumn, txtObj, isBold, addEnterCount, barcode) {
let txt = null;
let result = ‘’;
let space = ‘’;
try {
txt = txtObj;
} catch (e) {
console.log(‘Print Methot error : ’ + e);
}
let spaceLen = BBcolumn.Lenght - txt.toString().length;
for (var a = 0; a < spaceLen; a++) {
space += ' ';
}
if (BBcolumn.TextAlign === ‘right’) {
result = space + txt;
} else if (BBcolumn.TextAlign === ‘left’) {
result = txt + space;
}
isBold === true ? BluetoothEscposPrinter.setBlob(1) : BluetoothEscposPrinter.setBlob(0);
for (var i = 0; i < addEnterCount; i++) {
result += ‘\r\n’;
}
if (barcode === true) {
await BluetoothEscposPrinter.printerInit();
await BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.CENTER);
await BluetoothEscposPrinter.printBarCode(txtObj.toString(), BluetoothEscposPrinter.BARCODETYPE.CODE128, 3, 70, 0, 2);
await BluetoothEscposPrinter.printerAlign(BluetoothEscposPrinter.ALIGN.LEFT);
await BluetoothEscposPrinter.printText(‘\f’, {});
} else {
// console.log(result);
await BluetoothEscposPrinter.printText(result.replace(‘null’, ‘’),
{
encoding: ‘CP1254’,
fonttype: 1,
});
}
}
我尝试编码 1254 和 ıso88959-9 并编码 857(没有大写 İ,因此它没有).
I tried Encoding 1254 and ıso88959-9 and encoding 857(There is not Capital İ therefore It doesn't).
推荐答案
这是您的解决方案:
await BluetoothEscposPrinter.printText(result.replace('null', ''),
{
codepage: 25,
encoding: 'windows-1254',
fonttype: 1,
});
代码页非常重要.
这篇关于react-native-bluetooth-escpos-printer 编码土耳其字符问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文