Pavlo Yakovenko
Pavlo Yakovenko

Reputation: 143

Android: How to send unicode sms programatically and receive it on the other side correctly?

I am using simple code to send sms:

SmsManager.getDefault().
  sendTextMessage(phone, null, "English characters", sentPI, deliveredPI);

And all works fine.

But when I send sms message in russinan language, using this code:

SmsManager.getDefault().
 sendTextMessage(phone, null, "Русский текст", sentPI, deliveredPI);

I receive on the other emulator something like this: *&^#R*)@#_(&)@U(RH#*(&()^

How can I fix it? Please, help.

Upvotes: 5

Views: 2630

Answers (3)

Pavlo Yakovenko
Pavlo Yakovenko

Reputation: 143

Yes, it seems like an emulator bug. This question migrated to another one: https://stackoverflow.com/questions/8901477/android-receiving-another-bytes-after-sending-sms

Upvotes: 0

Jin35
Jin35

Reputation: 8612

This looks like a problem of emulator. I use SmsManager.sendMultipartTextMessage() method for sending Russian text, and no real user report about any problems. Try on real device please.

Upvotes: 1

Matt Aldridge
Matt Aldridge

Reputation: 2075

I would assume that you have to properly create the string.

For example:

new String("Русский текст", "UTF-16BE");

Watch out with your source code file. Normally it is safer to add the unicode character codes like \u0000. Otherwise you must always make sure you save your source code in UTF16 format.

Upvotes: 1

Related Questions