How to URL encode (percent encode) a string in Vala (GLib):

Uri.escape_string ("Hello, world!");

// Hello%2C%20world%21

To decode:

Uri.unescape_string ("Hello%2C%20world%21");

// Hello, World!

(Documenting it as it was not easy to find with a cursory web search.)

#vala #urlencode #urldecode #url #uri #escape #unescape #encode #decode #glib

#integromat 居然没有 #html #unescape 方法, #微博 同步过来的 #Kindle 读书标记里面的 " 死活去不掉。最后自己写几行代码挂主机上,加一个 #HTTP POST 模块,完美搞定。 https://mastodon.social/media/z1dsPy612KaHVK6v71M