Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send an SMS message (UTF-16) with an unknown character replaced by a "replacement character" in Android

I have a problem with sending SMS messages. I created a string with characters like "\uFDE8" (it's 65000). When I convert it back, I get 65000. It looks OK.

But when I send an SMS with this string and receive the message, I have this character replaced with "\uFFFD" (65533). This character is called a "replacement character".

Why was my character replaced?

//edit My solution is to convert each char of string to 7-bit and then send it. You must notice that gms alphabet is different from ascii (some chars needs to be replace to another). Good luck!

like image 229
hevy Avatar asked Jan 19 '13 09:01

hevy


1 Answers

According to the Unicode table, U+FDE8 is not a valid codepoint.

As you would expect, any invalid character gets replaced by your provider's SMS system by U+FFFD REPLACEMENT CHARACTER �, which in itself is a valid Unicode character, but only exists to show that the original one cannot be properly represented.

like image 68
mvp Avatar answered Oct 05 '22 22:10

mvp