How to convert UTF16 (emoji) to HTML Entity (hex) using java

后端 未结 1 1196
执念已碎
执念已碎 2021-02-11 06:40
How to convert UTF16 (emoji) to HTML Entity (hex) using java


I have the string from DB like this \"\\uD83D\\uDE02\". 
I try to display this unicode emoji, it displays          


        
1条回答
  •  孤街浪徒
    2021-02-11 07:16

    You can use emoji4j library for this.

    For example:

    String line = "Hi , i am fine \uD83D\uDE02 \uD83D\uDE02, how r u ?";
    
    EmojiUtils.hexHtmlify(line); //Hi , i am fine 😂 😂, how r u ?
    

    0 讨论(0)
提交回复
热议问题