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:
Adrien Destugues
2014-10-21 14:43:13 +02:00
parent d341a585ae
commit 9bf4e99477
4 changed files with 65 additions and 2 deletions
+3
View File
@@ -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,