dart 如何用Flutter和Zebra打印机打印欧元符号?

hpcdzsge  于 9个月前  发布在  Flutter
关注(0)|答案(5)|浏览(140)

我有我Flutter应用程序,使用cpcl命令与斑马zq220打印机通信。它工作正常,但不打印€欧元符号
这里我函数创建cpcl命令

List<String>lst=[];
lst.add("TEXT 4 2 0 80 € 12.9");
//HERE WITH OTHER COMMANDS AND FINALLY
String ss="";
for(int i=0;i<lst.length;++i)
{
ss+="${lst[i]}\r\n"
}
await sendByte(ss);

字符串
这是我的函数,要发送到我的斑马打印机

Future<void> sendByte(String scmd) async {
  
    List<BluetoothService> services = await connectDevice!.discoverServices();
    for (BluetoothService service in services) {
     
      var characteristics = service.characteristics;
     
      for (BluetoothCharacteristic c in characteristics) {
        
//here are three encode type that work fine all with zebra printer, but they don't print euro symbol
           c.write(gbk.encode(scmd));
           //c.write(utf8.encode(scmd));
          //c.write(gbk_bytes.encode(scmd));
       
      }
    }
  }


所以有人能帮我找到解决方案,如何打印欧元符号与此??提前感谢最好的问候

jmo0nnb3

jmo0nnb31#

你应该检查CPCL for Link-OS Enabled Printers手册。
在第198页上,它说-没有任何代码页更改-字符0x80应该是€符号。

rqqzpn5f

rqqzpn5f2#

尝试通过在字符串中输入转义字符序列而不是欧元符号来获取欧元符号。
欧元转义字符在下面以红色突出显示:


的数据

osh3o9ms

osh3o9ms3#

如果我没记错的话,如果你用ZPL和打印机通信,你可以把$的字符发送到打印机。如果参数正确,打印机会打印出好的字符。
在我的情况下,这是一个斑马标签打印机。

1zmg4dgp

1zmg4dgp4#

使用
$
在它之前,然后在$之后复制欧元符号

nc1teljy

nc1teljy5#

Flutter支持在字符串中写入Unicode字符。要做到这一点,你只需要找到你想要的任何字符的Unicode值。对于欧元,它是20AC,对于将Unicode值放入字符串,你可以尝试这样做

String a = '\u{20AC}' // \u shows unicode and in {} write the value of the unicode character.

字符串
另外斑马打印机支持键入欧元键看看这个Printing the Euro Currency Symbol

相关问题