How to convert emoticons to its UTF-32/escaped uni

2019-02-28 12:06发布

I am working on a chatting application in WPF and I want to use emoticons in it. I am working on WPF app. I want to read emoticons which are coming from Android/iOS devices and show respective images.

On WPF, I am getting a black Emoticon looking like this. I somehow got a library of emoji icons which are saved with respective hex/escaped unicode values. So, I want to convert these symbols of emoticons into UTF-32/escaped unicode so that I can directly replace related emoji icons with them.

I had tried to convert an emoticon to its unicode but end up getting a different string with couple of symbols, which are having different unicode.

string unicodeString = "\u1F642";  // represents                 

2条回答
地球回转人心会变
2楼-- · 2019-02-28 12:46

Your escaped Unicode String is invalid in C#.

string unicodeString = "\u1F642";  // represents                                                                     
查看更多
The star\"
3楼-- · 2019-02-28 13:09

Please be aware that Encoding.Unicode is UTF-16 in C#. To read 32 bits Unicode, there is this Encoding.UTF32. Link on MSDN for Encoding.​UT​F32

查看更多
登录 后发表回答