0

The background is this: I'm using ClickaTell with a rented number to receive incoming SMS text messages. I'm writing some code to piece back together a multipart/concatenated SMS. To do this I need to extract information from the "User Data Header", or UDH. The format of a UDH is described here: http://en.wikipedia.org/wiki/Concatenated_SMS

Now, Clickatell sometimes send me a UDH that looks like this:

050003fe0303

And that's fine - that looks like a UDH. All good. But sometimes they send me a UDH that looks like this:

303530303033666530333033

Note that this is an alternative encoding of the same UDH as the first example above.

What I need to do is work out why these two encodings are equivalent. The second encoding is almost certainly made up of pairs of numbers. So:

30 = 0
33 = 3
35 = 5

what I don't understand is why the "3" prefix changes to a "6". It looks like this happens after we get to "8". I've managed to work out that 66 = f, 65 = e and 63 = c, so I'm GUESSING that the code is:

30 = 0
31 = 1
...
38 = 8
60 = 9
61 = a
...
66 = f

Can anyone confirm this encoding? Is it something you've seen before? Does anyone know why the 3 changes to a 6?

Yours curiously...

magicroundabout
  • 318
  • 2
  • 8

1 Answers1

1

ASCII hex codes for characters '0' - '9' are 0x30 -> 0x39.

0x61 is a lower case 'a', 0x66 is 'f' etc.

I'm not sure why you think '9' is 0x60?

You can see the full table here: http://www.asciitable.com/

Vicky
  • 12,934
  • 4
  • 46
  • 54
  • Brilliant! I knew someone would spot a pattern that I couldn't. Genius. Thank you. I was working on a totally different idea for the pattern, but I reckon you've got it. Thanks! – magicroundabout Nov 06 '11 at 21:38