get 7-bit from character (GSM 03.38)

D

DraguVaso

Hi,

I need to a way to find the 7-bit code from a character. Or a function like
Asc() but that will give the character code based on the 7-bit ecoding (I
needf it fo convert text to GSM 03.38).

For exemple:
in ASCII (what I don't need!):
"é" -> 233 (= Asc("é") -> 11101001 (8 bits)

in 7-bit GSM 03.38 (what I need!!):
"é" -> 5 -> 0000101 (7 bits)

Does anybody knows how to get this?

Thanks a lot in advance,

Pieter
 
J

Jon Skeet [C# MVP]

DraguVaso said:
I need to a way to find the 7-bit code from a character. Or a function like
Asc() but that will give the character code based on the 7-bit ecoding (I
needf it fo convert text to GSM 03.38).

For exemple:
in ASCII (what I don't need!):
"é" -> 233 (= Asc("é") -> 11101001 (8 bits)

No, that's not ASCII. There are no accents in ASCII.
in 7-bit GSM 03.38 (what I need!!):
"é" -> 5 -> 0000101 (7 bits)

Does anybody knows how to get this?

It looks like you just need a mapping table - the reverse of the map
listed at

http://www.smsitaly.com/Download/ETSI_GSM_03.38.pdf

It shouldn't be too hard, especially given that all the valid
characters are in the first 256 values of unicode. Just have a byte
array with 256 values, where anything over 0x7f indicates that the
value is missing. For each character, check that the unicode value is
in the range 0-0xff, then find the byte value in the array. If it's
< 0x80, that's the value you want. If it's not, there's no such
character in GSM 03.38.

I suggest you write it as an Encoding, as you can then plug it into
your serial port code very easily.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top