sungsilnom / jsmpp

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

Can't send Swedish chars #105

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi.

I am trying to use jsmpp-2.1.0 for the integration of my application with my 
customer's SMSC.

I want to be able to send Swedish chars (ä, å, ö) in my submitShortMessage 
and I don't get them displayed properly on the phone.

Here is my code to submit the message:

...
DataCoding dataCoding = new DataCoding.newInstance((byte)0);
...
messageId = session.submitShortMessage(serviceType, sourceAddrTon, 
sourceAddrNpi, sourceAddr, destAddrTon, destAddrNpi, destinationAddr, esmClass, 
protocolId, priorityFlag, scheduleDeliveryTime, validityPeriod, 
registeredDelivery, replaceIfPresentFlag, dataCoding, smDefaultMsgId, 
shortMessage.getBytes("UTF-8"), sarMsgRefNum, sarSegmentSeqnum, 
sarTotalSegments);

With the above code and as an example, for the ö char I get c6. What am I 
doing wrong? I have tried a lot of stuff with the Data Encoding but the 
messages get to the phone Unreadeable. If it helps, swedish chars are ISO 
8859-1.

Thanks in advance,
Daniel

Original issue reported on code.google.com by danielvf...@gmail.com on 23 Jun 2011 at 3:00

GoogleCodeExporter commented 8 years ago
Hi.

I was able to solve my issue with:
...
DataCoding dataCoding = new GeneralDataCoding(false, true, MessageClass.Class1, 
Alphabet.valueOf((byte)4));
...
messageId = session.submitShortMessage(serviceType, sourceAddrTon, 
sourceAddrNpi, sourceAddr, destAddrTon, destAddrNpi, destinationAddr, esmClass, 
protocolId, priorityFlag, scheduleDeliveryTime, validityPeriod, 
registeredDelivery, replaceIfPresentFlag, dataCoding, smDefaultMsgId, 
shortMessage.getBytes(), sarMsgRefNum, sarSegmentSeqnum, sarTotalSegments);

Cheers,
Daniel

Original comment by danielvf...@gmail.com on 24 Jun 2011 at 6:27