MCPcopy Create free account
hub / github.com/KaisenAmin/c_std / encoding_url_encode

Function encoding_url_encode

encoding/encoding.c:874–900  ·  view source on GitHub ↗

* @brief Encodes a URL string by replacing special characters with their percent-encoded representation. * * This function encodes a URL string by replacing special characters with their * percent-encoded representation. Characters that are alphanumeric or one of * `-`, `.`, `_`, `~` are left unchanged. * * @param input Pointer to the input string. * @param length Length of the input stri

Source from the content-addressed store, hash-verified

872 free(result);
873 return NULL;
874 }
875
876 result[result_index++] = (char)((hi_index << 4) + lo_index);
877 }
878 else if (ch == '+') {
879 result[result_index++] = ' ';
880 }
881 else {
882 result[result_index++] = ch;
883 }
884 }
885 result[result_index] = '\0';
886
887 ENCODING_LOG("[encoding_url_decode] Decoding completed successfully");
888 return result;
889}
890
891
892/**
893 * @brief Encodes binary data into Base32 format.
894 *
895 * This function encodes a given input string into Base32 format. Base32 encoding
896 * uses 32 characters to represent binary data. The output is padded with `=` characters
897 * if necessary to ensure the encoded string length is a multiple of 8.
898 *
899 * @param input Pointer to the input binary data.
900 * @param length Length of the input data.
901 *
902 * @return A dynamically allocated buffer containing the Base32 encoded string.
903 * Returns NULL if an error occurs (e.g., memory allocation failure).

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected