project_files/frontlib/util/util.h
changeset 7227 1c859f572d72
parent 7224 5143861c83bd
child 7230 240620f46dd7
--- a/project_files/frontlib/util/util.h	Tue Jun 12 11:25:05 2012 +0200
+++ b/project_files/frontlib/util/util.h	Tue Jun 12 21:10:11 2012 +0200
@@ -45,4 +45,22 @@
  */
 void *flib_calloc(size_t count, size_t elementsize);
 
+/**
+ * Replace all non-alphanumeric and non-ascii bytes with escape
+ * sequences in the form %XX. Does not modify the original string,
+ * but returns a newly allocated one that must be free()d. Returns
+ * null on failure or if null was passed as argument.
+ *
+ * This should work fine with all ASCII-based charsets including UTF-8.
+ */
+char *flib_urlencode(const char *str);
+
+/**
+ * Replace escape sequences of the form %XX with their byte values.
+ * Does not modify the original string, but returns a newly allocated
+ * one that must be free()d. Returns null on failure or if null was
+ * passed as argument.
+ */
+char *flib_urldecode(const char *str);
+
 #endif