diff --git a/src/psl.c b/src/psl.c index f3b2156..f13bceb 100644 --- a/src/psl.c +++ b/src/psl.c @@ -704,10 +704,14 @@ static int _psl_idna_toASCII(_psl_idna_t *idna _UNUSED, const char *utf8, char * #if IDN2_VERSION_NUMBER >= 0x00140000 int rc; - /* IDN2_TRANSITIONAL automatically converts to lowercase */ - /* IDN2_NFC_INPUT converts to NFC before toASCII conversion */ + /* IDN2_TRANSITIONAL automatically converts to lowercase + * IDN2_NFC_INPUT converts to NFC before toASCII conversion + * Since IDN2_TRANSITIONAL implicitely does NFC conversion, we don't need + * the additional IDN2_NFC_INPUT. But just for the unlikely case that the linked + * library is not matching the headers when building and it doesn't support TR46, + * we provide IDN2_NFC_INPUT. */ - if ((rc = idn2_lookup_u8((uint8_t *)utf8, (uint8_t **)ascii, IDN2_NFC_INPUT | IDN2_TRANSITIONAL)) == IDN2_OK) + if ((rc = idn2_lookup_u8((uint8_t *)utf8, (uint8_t **)ascii, IDN2_NFC_INPUT | IDN2_NONTRANSITIONAL)) == IDN2_OK) ret = 0; /* else fprintf(stderr, "toASCII(%s) failed (%d): %s\n", lower, rc, idn2_strerror(rc)); */