Fallback to ASCII on output IDN conversion error
It is possible dig used ACE encoded name in locale, which does not
support converting it to unicode. Instead of fatal error, fallback to
ACE name on output.
(cherry picked from commit c8a871e908)
This commit is contained in:
+11
-3
@@ -4865,9 +4865,17 @@ idn_ace_to_locale(const char *from, char *to, size_t tolen) {
|
||||
*/
|
||||
res = idn2_to_unicode_8zlz(utf8_src, &tmp_str, 0);
|
||||
if (res != IDN2_OK) {
|
||||
fatal("Cannot represent '%s' in the current locale (%s), "
|
||||
"use +noidnout or a different locale",
|
||||
from, idn2_strerror(res));
|
||||
/*
|
||||
* Cannot represent in current locale.
|
||||
* Output ACE form undecoded.
|
||||
*/
|
||||
res = idn2_to_ascii_8z(utf8_src, &tmp_str, 0);
|
||||
if (res != IDN2_OK) {
|
||||
fatal("Cannot represent '%s' "
|
||||
"in the current locale nor ascii (%s), "
|
||||
"use +noidnout or a different locale",
|
||||
from, idn2_strerror(res));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user