Blender V5.0
uri_convert.cc File Reference
#include <cctype>
#include <cstdio>
#include "uri_convert.hh"

Go to the source code of this file.

Functions

bool url_encode (const char *str, char *dst, size_t dst_size)
 Encodes a string into URL format by converting special characters into percent-encoded sequences.

Function Documentation

◆ url_encode()

bool url_encode ( const char * str,
char * dst,
size_t dst_size )

Encodes a string into URL format by converting special characters into percent-encoded sequences.

This function iterates over the provided C-string and replaces non-alphanumeric characters (except for '-', '_', '.', '~') with their hexadecimal representations prefixed with ''. Spaces are converted into '+', following the conventions of URL encoding for forms (application/x-www-form-urlencoded).

Parameters
strThe input C-string to be URL-encoded.
dstThe output buffer where the URL-encoded string will be stored.
dst_sizeThe size of the output buffer dst.
Returns
: true if encoding was successful, or false if the output buffer was insufficient.

Definition at line 10 of file uri_convert.cc.

References i, and str.

Referenced by url_encode_wstring().