c# - send arabic letter to serial port -



c# - send arabic letter to serial port -

i utilize datamax printer , send serial port c# software print standard arabic in labels

code

serialport1.portname = "com1"; serialport1.baudrate = 9600; serialport1.open(); //serialport1.encoding = encoding.getencoding("windows-1256"); serialport1.encoding = encoding.ascii; serialport1.write("\x02" + "l" + "\x0d"); serialport1.write("d12" + "\x0d"); serialport1.write("h20" + "\x0d"); string test_arab = "الحملله"; serialport1.write("190000202600010 " + test_arab + "\x0d");//text //serialport1.write("b" + test_arab + "\x0d"); serialport1.write("q" + ' ' + test_arab + "\x0d"); serialport1.write("e" + "\x0d"); serialport1.close();

the result in labels "???????"

how can print standard arabic "الحمد لله"

you using ascii encoding

serialport1.encoding = encoding.ascii;

and source code of c# files in utf-8.

so seek convert string ascii write port:

byte[] pass_byte = encoding.ascii.getbytes("الحمد لله");

c#

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -