Reputation: 1252
How can I post an emoji? If I place it in url
instead of +message+
I will get wrong url, because sign "&"
makes url invalid and my message won't be send.
string url = "https://api.vk.com/method/messages.send?user_id=" + user_id + "&message=" + message + "&v=5.31&access_token=...";
♥ - ♥
Upvotes: 3
Views: 1467
Reputation: 27105
URL Encode you message by calling HttpUtility.UrlEncode
(link):
string message = "♥";
message = HttpUtility.UrlEncode(message);
Console.WriteLine(message); // outputs %26%239829
This will cause your data to never make the URL invalid, but still be readable as ♥
at the destination. You may have to reference System.Web
in your project.
Upvotes: 2