Java String and Hex character representation
Asked Answered
S

1

6

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

Sternutation answered 26/7, 2013 at 6:42 Comment(2)
What argument type does the method take?Peptize
SubmitSM sm = new SubmitSM(); sm.setShortMessage(content); - content is a String here. So I have a String value that must contain the Hex valuesSternutation
P
13

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

sm.setShortMessage(new String(new byte[] { 0x1b, 0x3c }));
Peptize answered 26/7, 2013 at 7:11 Comment(1)
What about sm.setShortMessage("[" + (char)0x1b + (char)0x3c);Preterition

© 2022 - 2024 — McMap. All rights reserved.