sanoopsivan / jsmpp

Automatically exported from code.google.com/p/jsmpp
Apache License 2.0
0 stars 0 forks source link

Support for decoding GSM character set #54

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
It would be helpful to have a method in jsmpp that decodes the GSM
character set to a String(), e.g. like this one which could be incorporated
as it's BSD-licensed:
http://embeddedfreak.wordpress.com/2008/10/08/java-gsm-0338-sms-character-set-tr
anslator/

In fact it would be helpful if there was a deliverSm.getString() method
with the decoding done already depending on datacoding value.

What steps will reproduce the problem?

1. Receive an SMPP message which includes '@' character
2. Convert to string without decoding, e.g. messageBody = new
String(deliverSm.getShortMessage()); 
3. String ends up with garbled characters as alphabets are mismatched

What is the expected output? What do you see instead?
@ is represented as binary 0

What version of the product are you using? On what operating system?
jsmpp 2.1.0

Please provide any additional information below.

Original issue reported on code.google.com by smarqu...@gmail.com on 1 Oct 2009 at 10:50

GoogleCodeExporter commented 8 years ago
The code here:

https://source.sakaiproject.org/contrib/sms/sms/trunk/impl/src/java/org/sakaipro
ject/sms/util/GsmCharset.java

particularly:

  public String gsmToUtf(byte[] dataGsm)

is an adaptation from the code referenced in the original issue, and converts
directly from GSM to UTF. (Converting via ISO-8859-1 is insufficient because 
not all
GSM chars are represented in it, e.g. euro symbol).

The code is licensed under ECL 2.0 (similar to Apache) and so can be 
incorporated
into jsmpp.

Original comment by smarqu...@gmail.com on 17 Dec 2009 at 4:42