From 8b6a69e71d36c26e378460c4e586593efe0b13da Mon Sep 17 00:00:00 2001 From: Tarek Mahmoud Sayed Date: Tue, 7 May 2019 15:35:46 -0700 Subject: [PATCH] Make Idn.GetAscii compatible with Windows (#24443) GetAscii on Windows ignore if the uri has hyphens in the third and fourth places. We relaxing this on Linux too for the sake of the consistent behavior. This issue was causing some problems with the http stack. --- src/corefx/System.Globalization.Native/pal_idna.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corefx/System.Globalization.Native/pal_idna.c b/src/corefx/System.Globalization.Native/pal_idna.c index 1d8786c..303a2ec 100644 --- a/src/corefx/System.Globalization.Native/pal_idna.c +++ b/src/corefx/System.Globalization.Native/pal_idna.c @@ -50,6 +50,9 @@ int32_t GlobalizationNative_ToAscii( int32_t asciiStrLen = uidna_nameToASCII(pIdna, lpSrc, cwSrcLength, lpDst, cwDstLength, &info, &err); + // To have a consistent behavior with Windows, we mask out the error when having 2 hyphens in the third and fourth place. + info.errors &= ~UIDNA_ERROR_HYPHEN_3_4; + uidna_close(pIdna); return ((U_SUCCESS(err) || (err == U_BUFFER_OVERFLOW_ERROR)) && (info.errors == 0)) ? asciiStrLen : 0; -- 2.7.4