Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 28
Registered: ‎07-17-2008
My Device: Not Specified

Intercepting SMS : Garbled Text

We have used MessageConnection to intercept incoming messages

 

(MessageConnection) Connector.open("sms://:" + port);

and am reading the Text using

 

 

Message m = conn.receive(); String msg = null; if ( m instanceof TextMessage) { TextMessage tm = (TextMessage) m; msg = tm.getPayloadText(); }

 

 

But my message contains few Special characters like Tilde (~), on receiving these message here tilde get converted into unreadable format.

 

I ve searched forum and found that this is a known issue and comes while sending through Datagram Connection and that too for Device Software Ver 4.1 or less.

However I am sending SMS via another Mobile to a Blackberry Device and using Software Version 4.2.

 

Any clues to the reason for the problem.

Developer
Posts: 205
Registered: ‎07-14-2008
My Device: 7230, 8700, 8820, 9000

Re: Intercepting SMS : Garbled Text

You might want to check the encoding of the outbound device.  I've played around with 8 bit encoded SMS messages, which results in special characters as you describe.

 

Have you tried receiving the SMS as a BinaryMessage?

 

Earl 

Earl Oliver
New Developer
Posts: 28
Registered: ‎07-17-2008
My Device: Not Specified

Re: Intercepting SMS : Garbled Text

II ve tried receiving as a BinaryMessage didnt helped.. I ve tried various Encodings also for inbound device but to no help

 

msgISO = new String(msg.getBytes("ISO-8859-1")); msgUTF8 = new String(msg.getBytes("UTF-8")); msgUTFBE = new String(msg.getBytes("UTF-16BE")); msgUSASCII = new String(msg.getBytes("US-ASCII"));

 

 

 

Retired
Posts: 86
Registered: ‎07-11-2008
My Device: Not Specified

Re: Intercepting SMS : Garbled Text

From which carrier network is the original SMS being sent and on which carrier network are you receiving the message?

 

It seems like you've addressed the usual suspects which are the encoding and using MessageConnection instead of DatagramConnection.   

Brian Zubert
Technical Partnership Manager
Research In Motion
Developer
Posts: 205
Registered: ‎07-14-2008
My Device: 7230, 8700, 8820, 9000

Re: Intercepting SMS : Garbled Text

Can you describe what you are trying to do?  Are your applications supposed to be exchanging text or 8-bit encoded data?

 

If you are sending from a phone, what encoding is it using?

 

Earl 

Earl Oliver