Android Question How to print Cent/Cedis Symbol with POS printer Xprinter XP 365B

mcqueccu

Well-Known Member
Licensed User
Longtime User
I recently bought Xprinter 365B Bluetooth/USB printer.

I am having problem printing the Cedis/Cent Symbol - GH¢ or ¢
Anyone using this same model or have can print the symbol should kindly help.

The following codes all did not work>


Also this printing.bas class
 
Solution
Thanks @aeric and @Peter Simpson for your help. These printer gave me really hard time, and countless waste of paper. But if finally works.

I tried all the code pages, and your suggestions but it was not working. Later I switched to chatgpt. After a few back and forth and revisions, changing of FONTS, etc, it concluded that the font glyph was not matched properly, that it was using DOUBLE BYTE MODE.


What it’s doing​

  1. 0x1C 0x26 (FS &)
    Tells the printer to start "Chinese character mode" (double-byte character mode).
    This makes the printer interpret the next bytes as double-byte characters (like Big5 or GB2312), not single-byte ASCII.
  2. 0x1C 0x43 0x01 (FS C 1)
    Sets the Chinese character...

aeric

Expert
Licensed User
Longtime User
Which code page you are using when print?
Do you see the character printer when doing Self Test?

In ESC/POS (Epson Standard Code/Printer Output System), the cent character (¢) is typically represented by the decimal value 162 or the hexadecimal value A2 in the IBM437 code page. To print it, you would use this value within your ESC/POS commands, often within a string sent to the printer.
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
Attached Image test 2.1 is the result from Self Test listing the code pages but when I set them it does not work.
I found a test software online, and when I click the Traditional Print (highlighted in Yellow) I see the symbol

1755007231776.png
 

Attachments

  • test 2.1.jpg
    test 2.1.jpg
    383.5 KB · Views: 36
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
Blank - empty space
What symbol you see?
it gives Blank - empty space like (GH )


I tried different codepages from 0 to 100. All showed empty

B4X:
     For i = 0 to 100
Printer1.Reset
    Sleep(1000)
    Dim cp As Int = i
    Printer1.CodePage = cp ' change this number to determine the codepage, see the printer manual
  
    Printer1.WriteString("Start of character set of Codepage " & cp & CRLF)
  
    Printer1.CharacterFont = 1
    Dim buffer(224) As Byte
    For i = 0 To 223
        buffer(i) = i + 32
    Next
    Printer1.WriteBytes(buffer)
    Printer1.WriteString(CRLF)
    Printer1.WriteString("End of character set of Codepage " & cp & CRLF & CRLF)
    Printer1.Reset
sleep(2000)
Next

Copilot suggested several subs like below (SORRY FORUM NOT ALLOWING ME TO POST THE CODE)

1755019598896.png
 
Last edited:
Upvote 0

aeric

Expert
Licensed User
Longtime User
Have you tried using WriteString ?
e.g
B4X:
Printer1.WriteString("30¢" & CRLF)
Printer1.WriteString("60" & Chr (162) & CRLF)
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Have you tried changing the code page to 850 or 1252 then printing HEX 9B or ASCII 155???

I always have to change the code page setting to 1252 when printing a Pound Sign (£) in my apps.

PXL_20250719_103631778.jpg


PXL_20250719_110358903.jpg




Enjoy...
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
Thanks @aeric and @Peter Simpson for your help. These printer gave me really hard time, and countless waste of paper. But if finally works.

I tried all the code pages, and your suggestions but it was not working. Later I switched to chatgpt. After a few back and forth and revisions, changing of FONTS, etc, it concluded that the font glyph was not matched properly, that it was using DOUBLE BYTE MODE.


What it’s doing​

  1. 0x1C 0x26 (FS &)
    Tells the printer to start "Chinese character mode" (double-byte character mode).
    This makes the printer interpret the next bytes as double-byte characters (like Big5 or GB2312), not single-byte ASCII.
  2. 0x1C 0x43 0x01 (FS C 1)
    Sets the Chinese character system to Big5 (0x01 = Big5, 0x00 would be GB2312).
    This is why Notepad++ detects “Big5 (Traditional)”.
  3. 0xA2 0xE3
    This is the actual Big5 encoding for the ¢ (cent) symbol.
    In Big5, the byte pair A2E3 maps to U+00A2 (¢).
  4. 0x1C 0x2E (FS .)
    Ends Chinese character mode, going back to single-byte mode.

After writing this code to cancel the Chinese mode, the other codes started to work

B4X:
    ' Full initialization + force CP850
    Dim initSeq() As Byte = Array As Byte( _
    0x1B, 0x40, _        ' ESC @   → Full reset (clear settings, reset mode)
    0x1B, 0x52, 0x00, _  ' ESC R 0 → Set international character set to USA
    0x1B, 0x74, 0x04, _  ' ESC t 4 → Set code page to CP850
    0x1C, 0x2E _          ' FS .    → Ensure Chinese mode is cancelled
    )

    ' Initialize printer to CP850
    Printer1.WriteBytes(initSeq)
  
    Printer1.WriteString("10" & Chr (162) & "- 20¢" & CRLF & CRLF)

    ' Now print the Cedi/Cent symbol in CP850
    Printer1.WriteBytes(Array As Byte(0x9B))
    Printer1.WriteString(" 5.00" & CRLF)

1755210923547.png



B4X:
Public Sub setCodePageFixed(codepage As Int)
    ' Build the ESC/POS sequence based on your fix
    Dim sequence As String
    sequence = ESC & "@" & _               ' Reset printer
               ESC & "R" & Chr ( 0 ) & _      ' International charset: USA
               ESC & "t" & Chr ( codepage ) & _ ' Set codepage dynamically
               FS & "."                   ' Cancel Chinese mode
    
    ' Send it to the printer
    WriteString(sequence)
End Sub
 
Last edited:
Upvote 0
Solution
Top