简体   繁体   中英

Escaping emoji characters

I am trying to post a tweet with emoji characters but when I try to escape them I get a 401 error. I tried using Uri.EscapeDataString and then HttpUtility.UrlEncode . I even tried this:

string escapedStr = "";
foreach (char ch in emoji)
    escapedStr += Uri.HexEscape(ch);

Is there a special way of escaping them?

This works for me

    string escapedStr = "";
    string emoji = "😁";
    Console.WriteLine(Uri.EscapeDataString(emoji)); //Prints %F0%9F%98%81

You are trying to get the individual characters? like: %F ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM