esc_pos_utils
esc_pos_utils copied to clipboard
Printing on other languages
Hi. Great job.
When we try to print Serbian (Eastern Europe languages CP1251, CP852, CP855. ), we got exception. We check 2 printers (with other programs it works great), and both support those CP.
Code:
bytes += generator.text('Test Print', styles: const PosStyles(align: PosAlign.center));
bytes += generator.text('Product 1');
bytes += generator.text('Product 2');
bytes += generator.text('šđžčć ŠĐŽČĆ', styles: const PosStyles(codeTable: 'CP1251')); // Latin2, Eastern Europe
bytes += generator.text('шђжчћљњ ШЂЖЧЋЉЊ ', styles: const PosStyles(codeTable: 'CP855')); // Cyrilic, Eastern Europe
Error:
[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Invalid argument (string): Contains invalid characters.: "šđžčć ŠĐŽČĆ"
#0 _UnicodeSubsetEncoder.convert (dart:convert/ascii.dart:85:9)
#1 Latin1Codec.encode (dart:convert/latin1.dart:40:46)
#2 Generator._encode (package:esc_pos_utils/src/generator.dart:77:21)
#3 Generator.text (package:esc_pos_utils/src/generator.dart:354:9)
#4 _MyAppState._printReceiveTest (package:f_flutter_pos_printer_platform_3/main.dart:162:24)
<asynchronous suspension>
Our printer capabilities where you can se supported CPs:
hey @nikolajocic did you find a solution?
did you find a solution?
Use Plugin https://pub.dev/packages/flutter_esc_pos_utils with codec utf8
Use Plugin https://pub.dev/packages/flutter_esc_pos_utils with codec utf8
@vipros123 how to use it with utf8?
how you use utf8 this package? https://pub.dev/packages/flutter_esc_pos_utils
Hi, it's very easy to support utf8 encoding. You just have to add an entry in the default section of capabilities.json and if you don't want to bother with that, you can use my fork:
https://github.com/waqadArshad/esc_pos_utils
as:
esc_pos_utils:
git:
url: https://github.com/waqadArshad/esc_pos_utils.git