Android Question problem with use writestring2

lelelor

Active Member
Licensed User
Hello, I'm using writestring2 (core) to use a code page to print the "€" symbol with escpos.
With VB6 this succeeds me, in B4A

I write this line
Printer1.WriteString2 ("€" & CRLF, "858")

and makes me the mistake
Printer error: java.lang.IllegalArgumentException: Null charset name

I know that the code page where the "€" symbol is resident is 858, it is likely that I write the command incorrectly, can you help me?
Thank you
 

lelelor

Active Member
Licensed User
NOW is set to IBM437
B4X:
 public Sub WriteString(data As String)
	WriteString2(data, "IBM437")
End Sub
but does not print "€" to me with VB6 codepage6 of escpos with sequence

B4X:
 Chr (27) & Chr (116) & Chr (6) & vbCrLf

prints "€" to me
i don't know how to transform this string with B4A
 
Upvote 0

lelelor

Active Member
Licensed User
this is the answer of SUNMI manufacturer

The easiest way is to use our print pick-up printText, you can call printing directly PrintText ("$ ¥ € £ ₣ N", null) If it is a developer printed with the ESC instruction, it corresponds to the different currency symbols, printing special characters.
The character set is not necessarily the same. It is recommended to use the UTF-8 character we specified (the device default is GB18030), and the setting of the character set FAQ7; For example, still print $ ¥ € € £ ₣ These symbols:
Need to send the instruction byte [] data = new byte [] {0x1c, 0x26, 0x1c, 0x43, 0xff} Set the printer receive UTF-8 character encoding Then sends the corresponding symbol data "$ ¥ € £ ₣" .GetBytes ("UTF-8") which is:
Senddata (New Byte [] {0x1c, 0x26, 0x1c, 0x43, 0xff}, null Senddata ("$ ¥ € £ ₣" .GetBytes ("UTF-8")

i don't understand what printtext is, sorry but i'm self taught and it's hard for me to understand
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
It's garbled but I think they are saying that you can set the printer to accept UTF-8 character sequences. The command sequence they give is an invalid definition of a downloaded custom character. This could be specific to their printer as the ESC/POS standard seems to assume the text is sent as values in a 256 character code page
Add the following Sub to the EscPosPrinter module, call it instead of setCodepage, then try using WriteString2(data, "UTF8")
B4X:
Public Sub setUTF8
    Dim params(5) As Byte
    params(0) = 0x1c
    params(1) = 0x26
    params(2 = 0x1c
    params(3) = 0x43
    params(4) = 0xff 
    WriteBytes(params)
End Sub
I've looked on the SUMNI web sote but I can't find manual for a thermal printer there. What's your device and do you have a manual for it?
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Found something The printer does support multi-byte encoding via non-standard command sequences as follows. What I said above should work. Here is also the list of single byte encodings supported.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…