]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
IDN: Use TR46 'transitional' for toASCII translations
authorTim Rühsen <tim.ruehsen@gmx.de>
Fri, 13 Jan 2017 08:36:33 +0000 (09:36 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 13 Jan 2017 09:21:25 +0000 (10:21 +0100)
References: http://unicode.org/faq/idn.html
            http://unicode.org/reports/tr46

Closes #1206

lib/url.c

index c7a91a4f7c92f78902dc57a0ad8647bfe255b52c..29beb38535e30c1dba491a61c8767da4fa26ba95 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -4010,7 +4010,12 @@ static void fix_hostname(struct connectdata *conn, struct hostname *host)
 #ifdef USE_LIBIDN2
     if(idn2_check_version(IDN2_VERSION)) {
       char *ace_hostname = NULL;
-      int rc = idn2_lookup_ul((const char *)host->name, &ace_hostname, 0);
+#ifdef IDN2_TRANSITIONAL
+      int flags = IDN2_NFC_INPUT | IDN2_TRANSITIONAL;
+#else
+      int flags = IDN2_NFC_INPUT;
+#endif
+      int rc = idn2_lookup_ul((const char *)host->name, &ace_hostname, flags);
       if(rc == IDN2_OK) {
         host->encalloc = (char *)ace_hostname;
         /* change the name pointer to point to the encoded hostname */