Unify URI encoding/decoding and add to C#

http_escape and percent_encode have been unified into uri_encode, and http_unescape and percent_decode have been unified into uri_decode.
This commit is contained in:
Aaron Franke
2020-11-29 22:43:38 -05:00
parent a3e3bf8227
commit e829b7aee4
15 changed files with 81 additions and 142 deletions

View File

@@ -1152,20 +1152,12 @@ TEST_CASE("[String] hash") {
CHECK(a.hash64() != c.hash64());
}
TEST_CASE("[String] http_escape/unescape") {
TEST_CASE("[String] uri_encode/unescape") {
String s = "Godot Engine:'docs'";
String t = "Godot%20Engine%3A%27docs%27";
CHECK(s.http_escape() == t);
CHECK(t.http_unescape() == s);
}
TEST_CASE("[String] percent_encode/decode") { // Note: is it redundant? Seems to be same as http_escape/unescape but in lower case.
String s = "Godot Engine:'docs'";
String t = "Godot%20Engine%3a%27docs%27";
CHECK(s.percent_encode() == t);
CHECK(t.percent_decode() == s);
CHECK(s.uri_encode() == t);
CHECK(t.uri_decode() == s);
}
TEST_CASE("[String] xml_escape/unescape") {