Here is some code of a script I wrote. It just takes in a string and replaces certain values with other values for URL building.
string messageReplace(string s)
{
s = replace_string(s, "%", "%25");
s = replace_string(s, "~", "%7E");
s = replace_string(s, "`", "%60");
s = replace_string(s...