hevy
hevy

Reputation: 91

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!

Upvotes: 6

Views: 2277

Answers (1)

mvp
mvp

Reputation: 116177

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.

Upvotes: 5

Related Questions