mirror of
https://github.com/mirror/wget.git
synced 2025-01-30 22:30:13 +08:00
* src/iri.c (idn_encode): Better IDNA 2003 compatibility
This commit is contained in:
parent
11d3de74ca
commit
936efc3564
@ -273,11 +273,14 @@ idn_encode (const struct iri *i, const char *host)
|
||||
|
||||
#if IDN2_VERSION_NUMBER >= 0x00140000
|
||||
/* IDN2_TRANSITIONAL implies input NFC encoding */
|
||||
if ((ret = idn2_lookup_u8 ((uint8_t *) src, (uint8_t **) &ascii_encoded, IDN2_NONTRANSITIONAL)) != IDN2_OK)
|
||||
{
|
||||
ret = idn2_lookup_u8 ((uint8_t *) src, (uint8_t **) &ascii_encoded, IDN2_NONTRANSITIONAL);
|
||||
if (ret != IDN2_OK)
|
||||
/* fall back to TR46 Transitional mode, max IDNA2003 compatibility */
|
||||
ret = idn2_lookup_u8 ((uint8_t *) src, (uint8_t **) &ascii_encoded, IDN2_TRANSITIONAL);
|
||||
|
||||
if (ret != IDN2_OK)
|
||||
logprintf (LOG_VERBOSE, _("idn_encode failed (%d): %s\n"), ret,
|
||||
quote (idn2_strerror (ret)));
|
||||
}
|
||||
#else
|
||||
/* we need a conversion to lowercase */
|
||||
lower = u8_tolower ((uint8_t *) src, u8_strlen ((uint8_t *) src) + 1, 0, UNINORM_NFKC, NULL, &len);
|
||||
|
Loading…
Reference in New Issue
Block a user