BUrl: IDNA ToUnicode and ToASCII conversions.
* Since DNS are normally restricted to ASCII, the use of UTF-8 in domain names is implemented using a "punycode" encoding. * The request to the DNS server must be sent with the ASCII representation of the domain name, however the Unicode one should be used for user-visible parts. * ICU provides an implementation of the conversion, which we use here. * Conversion is currently done in-place and modifies the BUrl object (this is similar to UrlEncode/UrlDecode). * Adjust existing IDN test to make use of these methods. It's passing now.
This commit is contained in:
@@ -64,6 +64,9 @@ public:
|
||||
void UrlEncode(bool strict = false);
|
||||
void UrlDecode(bool strict = false);
|
||||
|
||||
status_t IDNAToAscii();
|
||||
status_t IDNAToUnicode();
|
||||
|
||||
// Url encoding/decoding of strings
|
||||
static BString UrlEncode(const BString& url,
|
||||
bool strict = false,
|
||||
|
||||
Reference in New Issue
Block a user