mirror of
https://github.com/mirror/wget.git
synced 2025-03-27 12:30:19 +08:00
* src/iri.c (idn_encode): Better IDNA 2003 compatibility
This commit is contained in:
parent
11d3de74ca
commit
936efc3564
13
src/iri.c
13
src/iri.c
@ -273,11 +273,14 @@ idn_encode (const struct iri *i, const char *host)
|
|||||||
|
|
||||||
#if IDN2_VERSION_NUMBER >= 0x00140000
|
#if IDN2_VERSION_NUMBER >= 0x00140000
|
||||||
/* IDN2_TRANSITIONAL implies input NFC encoding */
|
/* 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)
|
||||||
logprintf (LOG_VERBOSE, _("idn_encode failed (%d): %s\n"), ret,
|
/* fall back to TR46 Transitional mode, max IDNA2003 compatibility */
|
||||||
quote (idn2_strerror (ret)));
|
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
|
#else
|
||||||
/* we need a conversion to lowercase */
|
/* we need a conversion to lowercase */
|
||||||
lower = u8_tolower ((uint8_t *) src, u8_strlen ((uint8_t *) src) + 1, 0, UNINORM_NFKC, NULL, &len);
|
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