Java String and Hex character representation

lulu88 picture lulu88 · Jul 26, 2013 · Viewed 15.9k times · Source

I am trying to send a square bracket to a phone using logica smpp 1.3.7. I use dataCodingSetting of 3 - as per the network I asked about this. They advised that I need to package my message as below:

  You want to send ASCII                Send the following

  Character  Decimal  Hex              Character    Hex     Decimal
     [         91     5B                <ESC><     1B 3C     27 60

My question is, I have no clue what this character is: ESC < And if I put just the Hex value of 1B 3C it comes out on the phone as exactly that: 1B 3C

Answer

bowmore picture bowmore · Jul 26, 2013

I guess they want a String containing the bytes 0x1b and 0x3c so :

sm.setShortMessage(new String(new byte[] { 0x1b, 0x3c }));