Are you displaying the Unicode character correctly in a TextView?

I get a string sent to me from the server (my application runs on Android). One of the characters is the Unicode character, which is a musical note. I take the response from the server in String, and then pass it directly to the TextView. Here's what you should get:

โ™ซ

but instead I only see the block (it seems to look):

[]

when I print the line for logcat, I see:

รขยซ

I am not sure how to get TextView to display the character correctly. I tried this:

tv.setText(Html.fromHtml(text).toString());

but it still displays the block. What is the right way to do this?

thank

-------------------- Update -------------------------- ---

- , ( ). , , ?:

<html>
  <body>
    &#x266B;
    <br />
    &#9835;
  </body>
</html>
+3
1

:

org.apache.commons.lang.StringEscapeUtils

unescapeHtml unescapeXml, Unicode. , Android Droid, , . - , , StringEscapeUtils , , .

+1

Source: https://habr.com/ru/post/1773293/


All Articles