Please allocate the destination buffer keeping in mind that encoding a special character will take up 3 bytes (for '%' and two hex digits). In the worst-case scenario, the destination buffer will have to be 3 times that of the source string.
Examples
example_uri_encode() is referenced by 1 libraries and example projects: