The UrlEncoder class provides a method for encoding a string using a specific encoding scheme.
For more information on the class features, see UrlEncoder and UrlDecoder.
The following example demonstrates how to use the UrlEncoder class.
// includes #include <FBase.h> // namespace using namespace Osp::Base; using namespace Osp::Base::Utility; void MyClass::UrlEncoderSample(void) { result r = E_SUCCESS; String str1(L"url encoding test?"); String str2; // Encode the input string. r = UrlEncoder::Encode(str1, L"UTF-8", str2); }
Static Public Member Functions | |
static result | Encode (const Osp::Base::String &str, const Osp::Base::String &encodingScheme, Osp::Base::String &encodedStr) |
static result Osp::Base::Utility::UrlEncoder::Encode | ( | const Osp::Base::String & | str, |
const Osp::Base::String & | encodingScheme, | ||
Osp::Base::String & | encodedStr | ||
) | [static] |
Encodes an input string using a specific encoding scheme.
It encodes all unsafe characters of a string.
[in] | str | An instance of String to be encoded |
[in] | encodingScheme | The supported encoding scheme |
[out] | encodedStr | The encoded string |
E_SUCCESS | The method is successful. |
E_INVALID_ARG | A specified input parameter is invalid. |
E_OUT_OF_MEMORY | The memory is insufficient. |
E_SYSTEM | A system error has occurred. |
E_UNSUPPORTED_TYPE | The specified encoding scheme is not supported. |
E_INVALID_ENCODING_RANGE | The specified string contains code points that are outside the bounds of the character encoding scheme. |