Use TR46 transitional with libidn2 >= 0.14
This commit is contained in:
parent
7d5f3a67af
commit
2c17d56234
12
src/psl.c
12
src/psl.c
|
@ -701,6 +701,17 @@ static int _psl_idna_toASCII(_psl_idna_t *idna _UNUSED, const char *utf8, char *
|
||||||
fprintf(stderr, "Failed to convert UTF-8 to UTF-16 (status %d)\n", status); */
|
fprintf(stderr, "Failed to convert UTF-8 to UTF-16 (status %d)\n", status); */
|
||||||
}
|
}
|
||||||
#elif defined(WITH_LIBIDN2)
|
#elif defined(WITH_LIBIDN2)
|
||||||
|
#if IDN2_VERSION_NUMBER >= 0x00140000
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
/* IDN2_TRANSITIONAL automatically converts to lowercase */
|
||||||
|
/* IDN2_NFC_INPUT converts to NFC before toASCII conversion */
|
||||||
|
|
||||||
|
if ((rc = idn2_lookup_u8((uint8_t *)utf8, (uint8_t **)ascii, IDN2_NFC_INPUT | IDN2_TRANSITIONAL)) == IDN2_OK)
|
||||||
|
ret = 0;
|
||||||
|
/* else
|
||||||
|
fprintf(stderr, "toASCII(%s) failed (%d): %s\n", lower, rc, idn2_strerror(rc)); */
|
||||||
|
#else
|
||||||
int rc;
|
int rc;
|
||||||
uint8_t *lower;
|
uint8_t *lower;
|
||||||
size_t len = u8_strlen((uint8_t *)utf8) + 1;
|
size_t len = u8_strlen((uint8_t *)utf8) + 1;
|
||||||
|
@ -717,6 +728,7 @@ static int _psl_idna_toASCII(_psl_idna_t *idna _UNUSED, const char *utf8, char *
|
||||||
fprintf(stderr, "toASCII(%s) failed (%d): %s\n", lower, rc, idn2_strerror(rc)); */
|
fprintf(stderr, "toASCII(%s) failed (%d): %s\n", lower, rc, idn2_strerror(rc)); */
|
||||||
|
|
||||||
free(lower);
|
free(lower);
|
||||||
|
#endif
|
||||||
#elif defined(WITH_LIBIDN)
|
#elif defined(WITH_LIBIDN)
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue