diff --git a/punycode.js b/punycode.js index 752b98a..ac9d577 100644 --- a/punycode.js +++ b/punycode.js @@ -14,7 +14,7 @@ const initialN = 128; // 0x80 const delimiter = '-'; // '\x2D' /** Regular expressions */ -const regexPunycode = /^xn--/; +const regexPunycode = /^xn--/i; const regexNonASCII = /[^\0-\x7F]/; // Note: U+007F DEL is excluded too. const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators @@ -389,7 +389,7 @@ const encode = function(input) { const toUnicode = function(input) { return mapDomain(input, function(string) { return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) + ? decode(string.slice(4)) : string; }); }; diff --git a/tests/tests.js b/tests/tests.js index ced85a0..24fef56 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -190,6 +190,14 @@ const testData = { 'decoded': 'caf\xE9.com', 'encoded': 'xn--caf-dma.com' }, + { + 'decoded': 'ÜBER.COM', + 'encoded': 'xn--BER-ska.COM' + }, + { + 'decoded': 'sPhÈRè.com', + 'encoded': 'xn--sPhR-nka7q.com' + }, { 'decoded': '\u2603-\u2318.com', 'encoded': 'xn----dqo34k.com'