AceCommon
1.1.2
Arduino library for low-level common functions and features with no external dependencies
|
Go to the source code of this file.
Functions | |
void | ace_common::formUrlEncode (Print &output, const char *str) |
Encode the str using an encoding suitable for GET parameters and forms in the body of a POST that expects a application/x-www-form-urlencoded type. More... | |
void | ace_common::formUrlDecode (Print &output, const char *str) |
Decode the str that was encoded using form_url_encode(). | |
Provides 2 functions to perform URL form encoding and decoding. A space ‘’ 'is converted into a
'+'`, and all other non-alphabetical characters are converted into %{hex}.
Definition in file url_encoding.h.
void ace_common::formUrlEncode | ( | Print & | output, |
const char * | str | ||
) |
Encode the str using an encoding suitable for GET parameters and forms in the body of a POST that expects a application/x-www-form-urlencoded type.
A ' ' is converted into a '+' and non-alphanumerics are percent-encoded.
The result is printed to the output
that implements the Print
interface. The output
could be the Serial
object, but more frequently, it is useful to use an in-memory buffer such as PrintStr
. This allows us to avoid using a String object, which decreases the risk of heap fragmentation.
See https://en.wikipedia.org/wiki/Percent-encoding and https://stackoverflow.com/questions/1634271.
Definition at line 47 of file url_encoding.cpp.