How do I send emoji?
How can I send emoji? If I put it in url
instead +message+
, I get a wrong url, because the sign "&"
makes the url wrong and my message won't be sent.
string url = "https://api.vk.com/method/messages.send?user_id=" + user_id + "&message=" + message + "&v=5.31&access_token=...";
♥ - & # 9829
+3
source to share
1 answer
URL Encode the message by calling HttpUtility.UrlEncode
(link) :
string message = "♥";
message = HttpUtility.UrlEncode(message);
Console.WriteLine(message); // outputs %26%239829
This will ensure that your data will never invalidate the URL, but will be readable as ♥
in the destination. You may need to link to System.Web
in your project.
+2
source to share