02-06-2012 12:27 PM
I have a TextMessage object being given to be from an SMS.sendMessage(). The TextMessage object has getAddress and getPayloadText. What is the encoding of this string?
I am assuming it is GSM 7bit encoded text, however when i decode the getBytes() it fails and int he place of a Euro symbol i get a ?, this is the same for any characters outside of the normal a-z, 1-9 and basic punctuation style text.
I need to wrap up the payload and send it elsewhere to another server. So i was planning to encode the string as base64 to make it safe for me transport. Currently through i cannot get the payload text in a usable format that I can rely on.
How do i get this into UTF-8, or UTF-16BE format with the GSM 7bit characters preserved. I have tried the new String(sms.getPayloadText(), "UTF-16BE") however this also fails to give me the text as seen on screen. i.e with foreign characters. When decoded it return ???? for the characetrs outside of its character set.
02-17-2012 05:34 PM
Sorry, I am not familiar with the problem. However I would have thought that using getBytes("UTF-8"), and then base64 encoding the resultant bytes would have given you a text String that would get through OK. Do the reverse at the other end. Will this work for you?
06-18-2012 04:53 PM
I've just unpacked (no pun intended) something similar, but in reading SMS data from the datagram. The data was packed in GSM 7-bit and there was some conversion required. I tried all the standard character set encoders that come with BB, to no avail. I then stumbled upon this reference [http://www.wrankl.de/JavaPC/SMSTools.html] which was quite useful for PDU and SMS encoding/decoding.... G'luck!